setVariableValueExt() ignored within On Variable Initialization when Load In Script = TRUE
Issue: When an applications data sources are set to load in script, attempting to set variables within On Variable Initialization ceases to work.
Workaround: Move setVariableValueExt() code to On Background Processing AFTER the data source has been loaded (i.e. DS_1.loadDataSource()).
- Is this expected behavior?
- If we execute loadDataSource and then subsequently setVariableValueExt(), wont this refresh the data source twice?
- How does this work in scenarios where we have multiple data sources with different subsets of the total amount of variables used by the application? (e.g. DS_1 contains 2 out of 5 variables, DS_2 contains 3 out of 5 variables and so on and so fourth. In this scenario we would not be able to set variable values until a sufficient number of data sources have been loaded).
Karol Kalisz replied
Design Studio is not holding the variable values, those are passed directly through BICS layer to the OLAP processor. This means, you can set values only on variables which are available. Variables which are in data sources which are not yet loaded are not available.
in your scenario, once DS_1 is loaded, you can set the variable values for 1,2 & 5. then if you load DS_2, the value of variable 1 is already available (variable merge is active in DS per default). You need set the variable 4 immediately, other wise - in case it is a mandatory variable - the prompt screen will be shown.
If you have a chain which you interrupt (like DS_1 in first backgroung processing call), then you render and call background processing again for DS_2 - the variable SUBMIT will be done shortly before rendering starts (as nothing can be rendered w/o submitted variables.
[...]I won't be able to call setVariableValueExt()[...]
-> what you mean here, check this against explanation above.
Always, first the DS must be loaded, then all variables which are already "known" in OLAP processor can be set.