Skip to Content

DS 1.2 - New Event Triggers

On Variable Initialization:
Usecase:
Until 1.1, the OnStartup event is fired AFTER initial variable submit.  This has the effect of:
  • submitting variables twice, if variables are set in the startup script
  • As a side-effect, prompting the user for mandatory variables even if they will be set in the startup script.
Solution:
Now with the introduction of a new event On Variable Initialization, variable values can be submitted using this event.
On Variable Initialization is called before On Startup event. So, the variable values are submitted only once and there won't be any prompt for mandatory variables if they are set using this event.
Where to Find this: Application -->  Properties --> Events

On Variable Initialization is an event similar to On StartUp or On Click.

Potentially you can add any script to get executed On Variable Initialization.

But a logical usage would be to include

APPLICATION.setVariableValue("VariableName", "Value to be set");

How does it help? What is the difference between adding this script On start up and adding this On Variable Initialization. Let us understand.

Type of variable: Mandatory single value variable

What happens On Start up:

Variable prompt appears on application execution despite setting the variable on start up.

Reason - Datasource call + variable call happens before On Start up call.

What happens On Variable Initialization:

Variable prompt doesn't appear and the application renders with variable value set.

Reason - On Variable Initialization call happens before Datasource or variable call and hence values are set as desired.

On Background Processing:
Usecase:
As an application developer you would like to have the flexibility to run events in the background.
Consider the following scenario:
1. Application contains 3 pages.
2. Page 1 is the landing page and Page 2 and 3 contain detailed reports. Jumps to these pages are provided in page 1.
3. Datasources in Page 2 and 3 are huge and usually takes 2 minutes to load.
Until 1.1 initial application load will take a lot of time as all these datasources are loaded in the initial state.
Even if you control the datasource by using load datasource on clicking on pagebook item, it takes 2 minutes to load the page.
In such situations we need a capability to load datasources in background in Page 2 and 3 while we are working on page 1.
Solution:
Now with the introduction of a new event On Background Processing, we can add those processes as events which are to be executed in the background.
This event is triggered only when the following script call is made.
APPLICATION.doBackgroundProcessing();
doBackgroundProcessing()
Calls thescriptoftheOnBackgroundProcessingproperty. ItisexecutedinthebackgroundwhentheUserInterfaceisrendered.
In the above explained usecase this script needs to be included On Startup.
In On Background Processing Event following script needs to be used to start load of the datasources in page 2 and 3 on background as soon as the application is rendered.
DS_1.loadDatasource();
DS_2.loadDatasource();
Where to Find this: Application -->  Properties --> Events
On Result Set Changed:
Usecase:
For cases where data is read and filled into components via script, it is necessary to give the application developer a place to fire logic which refreshes this data, when the resultset from the datasource has changed or when the datasource is first initialized.
Consider a usecase where the Dropdown needs to be populated with values whenever data is loaded in DataSource.
Unless the data is loaded (DS_1.loaddatasource()) the setitems event for dropdown will result in error and this can't be avoided until 1.1.
Solution:
Datasource --> Properties --> Events --> On Result Set Changed
Now we can load data in dropdown whenever data is loaded in DS_1 using On Result Set Changed event.

In order to complete this with related use cases, there should also be methods on the datasource for:

  • isInitialized
  • isResultSetEmpty

E.g. Add the below script in On Result Set Changed Event:

if

(DS_1.isInitialized())

{

DROPDOWN_1.setItems(DS_1.getMemberList(

"0BC_VEND1__0BC_EVAL", MemberPresentation.INTERNAL_KEY, MemberDisplay.KEY, 10, "All"));

}

This will ensure that whenever DS_1 is initialized DROPDOWN_1 is set with items from the datasource.

Former Member