Qlik Community

Qlik Sense Integration, Extensions, & APIs

Discussion board where members can learn more about Integration, Extensions and API’s for Qlik Sense.

tschollqlikview
New Contributor III

Changing variables and getting their values

Dear all,

I am faced with a problem that even after hours I could not solve:

In an extension I am calling this function:

switchStatus: function (id, varName, ValueOn, ValueOff ){

       var app = qlik.currApp();

       if($('#toggle'+ id).prop("checked")){

            app.variable.setStringValue(varName, ValueOn).then(function() {

                 var app2 = qlik.currApp();

                 app2.variable.getContent(varName, function(reply){

                 console.log(reply) // Always the initial value of the variable

            })

       });

  }

}

I am changing the value of the variable via

app.variable.setStringValue(varName, ValueOn);


I can see the change omthe GUI, however when trying to get the new value of the variable via

      app2.variable.getContent(varName, function(reply).....

the result is always the initial value of the variable.


What am I doing wrong?


1 Reply
nikoskavroulaki
New Contributor II

Re: Changing variables and getting their values

Any luck with this one I am facing the same issue.

I am using the getContent and SetStringValue to get and set the value of variables.

SetStringValue changes the value, however the getContent does not update on the next iteration