Skip to Content

Design Studio 1.5: View on Variable "synchronized" Unmerge Scenario


A view on the variable "synchronized" un-merge scenario. This is a blog of the series "Design Studio 1.5, View on..." - here the function "synchronized Variable Unmerge". For more topics see Design Studio 1.5: What's New in? A (technical) View

When you need this?

There is a nice feature in release 1.5 - Design Studio 1.5: View on Parallel Data Source Execution - but there is also a prerequisite to use it - Design Studio 1.5: View on Variable Unmerge Scenario - and in case you still want to synchronize the values of variables, you need to know a way how to copy the values from one data source to another.

The Scenario

In this example, I will use the same query as 4 data sources, this means I always have the same variables in all queries.

The basic workflow is:

* I want to show single list of variables in prompt dialog

* when the user accepts with OK, I want to pass the selected values to other data sources

The technical data source load is:

* I start with 2 data sources loaded immediately (to show the copy of variables directly after prompt dialog OK button)

* 2 others are started parallel in background processing

* later, when all data sources are active, I want to distribute changed variables to all

My Data Source - the Variables

In my data source (query) I have 5 variables:

How to Start?

First, you have to remove the variables from prompt dialog you do not want to show to the end user:

Select only those you want to keep, remove all others (eg. from DS_2)

As you see in the prompt dialog, I have prepared the prompt to show only variables from DS_1, and using the Text property I have placed "V" to cover the source of the variables.

This is also how you can put together variables from DS_1 and DS_2 in one prompt, not showing from where those are coming to the user (you need to use the same "Text" in both data sources.

Then, we need to assure that the variables are loaded correctly (synchronized). I use for this the new event "on before prompts submit" on application level:

In this event, which is called always the prompt dialog is closed, we need to consider two cases:

1. the DS_3 and DS_4 is not yet loaded

2. all DS are loaded

In my case I know I initialize them on background processing, it means I can use a global variable to mark it.

of course, I can also use the method "DS_3.isInitialized();" instead of the variable. This is probably important when you are initializing the data sources really dynamically.

To visualize the current variables, I use small method to print them into text fields. Here, just side remark, a new "me" language construct to access the object where you are, eg. here is it DS_1 (me == DS_1)

How I synchronize the variables?

The main method is actually the "synchronizeVariables()" method.

It has two data sources as input parameters, is looping on the variables and coping the external values between data sources.

Here; I want to pay attention for line 7 - you need to check if your variable is input enabled. Only on input enabled variables you can use the setVariableValueExt method, in other cases you will get an exception.

The execution

Now, I will execute the application - in prompt I select the 0BC_TYPE_SE on "1".

You can see that the synchronize method has copied the variable to DS_2:

The DS_3 and DS_4 are not yet initialized, so nothing is shown.

I will change the variable 0BC_IREG to NRD

and also now, DS_1 has been changed and DS_2 synchronized.

Next step is, we will trigger the "on background processing" script - I will make it via button, but you can make it also in "on startup" script.

As the synchronize call is done directly after the data source is loaded, you can see that the copy works also in this case.



var variablesInQuery = DS.getVariables();

var output = "";

variablesInQuery.forEach(function(variable, index) {

  output = output + + "\r\n" + DS.getVariableValueExt(variable) + "\r\n" + "\r\n";




// get all variables from the data source

var variablesInQuery = fromDataSource.getVariables();

// loop on all variables

variablesInQuery.forEach(function(variable, index) {

  // copy values only for those which are input enabled

  if(variable.inputEnabled) {

  // get the external string

  var variableValueExt = fromDataSource.getVariableValueExt(variable);

  // set the external string

     toDataSource.setVariableValueExt(variable, variableValueExt);




This is how you can still "synchronize" logically the variables, but use unmerge positive aspects and even activate parallel execution.

I hope all is clear now ;-)


Perhaps not all aspects are covered yet, in case of questions, feel free to ask.