Qlik Community

Qlik Sense Integration, Extensions, & APIs

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

alandjoe
New Contributor

getContent method and callback function

Hi,

I've been working on an extension that loads some values from variables and uses those values to decide which functions to run etc. To get those values from variables I used getContent method ( getContent method ‒ Qlik Sense Developers ). It worked fine on Qlik Sense desktop version but I ran into problems when I tried the extension on Qlik sense enterprise. The problem is that the callback function doesn't get the value from getContent method before the value is used. The functions are structured like this:

app.variable.getContent(variablename1, function(reply1){

     app.variable.getContent(variablename2, function(reply2){

          FunctionX(reply1, reply2);

     });

});

I also tried to use promises to solve this but these attempts were unsuccessful though. Can someone help me with this issue?

1 Reply
erik_wetterberg
Honored Contributor

Re: getContent method and callback function

Don't use getContent in an extension, add a property instead, and use the variable in the property panel. Qlik client will then solve the problems with asynchronity for you.

Erik Wetterberg

Erik Wetterberg
https://extendingqlik.upper88.com/
Community Browser