This Blog explains how to Process Data Sources in Parallel by using Processing Group, Un-Merge Prompt and Global Scripts Object.
Scenario: Your Application contains many numbers of Tabs and each has multiple Data Sources. Also, you have to apply filter to all these data sources based on the user input.
Challenges: Your Dashboard performance is going to take a hit, because of the number of Data sources to be loaded. Also, there is a need for the application of filter to all these Data sources, and whenever there is any change in filter values, these Data Sources to be reloaded again.
Solution: Design Studio 1.5 has many performance improvement features. We will take a look at few of them and how to use them effectively while creating the Application.
Process the Data Sources in Parallel
By default, the Data sources are process one after other, in a sequential order. This process consumes more time, and the Application load will take lots of time. To avoid this, we can process the Data Sources in Parallel.
Step 1: For each of the Data Source, make the property Load in Script: True.
When we select a Data source to Load in Script, application will not load the Data source on_Startup. Developer has to load the Data Source though a script. By this, we can decide when each of these Data Source to be loaded. Also specify a Processing Group. This can be any user defined name. While mentioning Processing Groups, you can group a set of Data Sources into one group. All Data Sources, belongs to one group get processed Sequentially and each Processing Group get processed in Parallel.
Like the below diagram, Processing_Group1, 2 and 3 will be processed in Parallel. Under each Processing Group, Data sources will get processed sequentially. So DS_1, DS_2 and DS_7 will be processed in Parallel, DS_3, DS_4, DS_8 after that and DS_6 and DS_5 in the next stage.
By processing in Parallel, the Application loads fast.
Step 2: Un-Merge Prompts: Set the Merge Prompts and Force Prompts on Startup option to False. This scenario is required for use of parallel query execution. Even you want to merge the variables, technically you need to use unmerge. With additional synchronization scripts you have to achieve a “simulated Merge” mode. In order to activate the parallel query execution, you have to run the application in unmerge scenario.
Step 3: As mentioned above, we have to stimulate the Merge scenario through Script. We have to load each Data Source by applying the filter values to them.
In Design Studio 1.5, Global Scripting Object can be used as a Function to process repeatedly used tasks. Instead of loading each Data source and applying the filter one after other, we can use this functionality to create a Global Script Object and load the
Data Sources by passing them through this script. This helps us in ease of Application maintenance. If a new Data Source to be added later, or a New Filter to be applied, this can be achieved by Adding / Changing a single line of code.
You create an initial screen to capture the filter / prompt values. For the ‘On Click’ value of Refresh button, you can call the Global Script Object.
Step 3.1: Create a Global Script Object by selecting Global Scripts Object from the Technical Components Menu.
By right clicking the new Global Script Object and selecting Create Script Function we can create a new Global Script Object.
Step 3.2: Create the new Global Scripts Object. You have to create one Input Parameter by selecting Insert button. This Input Parameter should be of DataSourceAlias type.
Write the script similar to the one shown below. Load the Data Source (loadDataSource()) and pass the prompts (setVariableValueExt()) to it, by referring to the Incoming Data Source Name assigned through the Input Parameter.
Step 3.3: Create the new Tab, where we capture the Prompt values and process it through the script. We call the Global Scripts Object from the Refresh button ‘On Click’ event.
We will pass all Data Sources through the Global Scripts Object by calling the function like:
Having a Global Script will help us in managing the Application easily. If a new Data Source to be added or a new filter to be incorporated, all we need to change at one place only.
Thus, by combining Load in Script, Processing Group, Un-Merge of Prompts and Global Scripting Object we will be able to Load the Dashboard much faster.