Skip to Content
Former Member
Jan 06, 2017 at 02:58 PM

DS.getData() does not show updated value after DS refresh with DS.setVariableValue().



I wonder if it's another bug in DS, or I'm doing something wrong. The DS.getData() does not show updated value after my DS is refreshed by DS.setVariableValue().

My DS is restricted by default by fiscal year variables 001.2017-012.2017. I use the following code to get the value for a particular measure and member:

var myValue = DS.getData("8XTGMGN8NEDHZYZLCDPMKX644",{"0PROJECT":someProject}).value;

The result is myValue=100 and I display it in a text box.

Then I want to use a dropdown box to change variables on the DS to 009.2017. OnClick code runs and does the following:

DS.setVariableValue("someVariable", "2017009");

var myValue = DS.getData("8XTGMGN8NEDHZYZLCDPMKX644",{"0PROJECT":someProject}).value;

I am expecting myValue to change to 5, and update the text box, but it still says 100. Why?

I have tried loading DS after setVariableValue using loadDataSource() but that did not help either: getData gets triggered before DS has a chance to update. And I can actually see it when I add an APPLICATION.alert(myValue) in my code - I can see the alert on screen immediately, while DS is still being refreshed in the background.

Is this a bug, or am I doing something wrong? I would have thought that the setVariableValue will refresh my DS and then getData will pick up correct value? Or do these two run asynchronously?