0 Replies Latest reply: Mar 16, 2017 1:30 PM by Tobias Scholl RSS

    Changing variables and getting their values

    Tobias Scholl

      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?