Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
noa_elharrar
Contributor
Contributor

Qlik Sense Extension - Get variable value


How to get the value of a variable defined in qlik sense in an extension written in java script?

I tried it but it did not work for me

require(["js/qlik"], function(qlik) {
  //open the app
  var app = qlik.openApp('c31e2aba-3b46-4b13-8b87-c5c2514dea1d', config);
  //get the variable content
  app.variable.getContent('MYVAR',function ( reply ){
    alert( JSON.stringify( reply ) );
  });
});

Thank you!

2 Replies
dannyy81
Contributor III
Contributor III

strange - did you write the variable in the app the same by case sensitive? 

blah
Contributor
Contributor

This works for me:
           
app.variable.getContent("toggleChart", function (reply) {
    var clickItem = JSON.parse(JSON.stringify(reply)).qContent.qString;
    console.log("clickItem: " + clickItem);
});