Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
Qlik® Product Spotlight: Discover what’s possible. Get more from our products.
See for yourself. Register today.
materysaudie
New Contributor

How to pass a variable from a getList method to an external function

Hi Everyone!

I have the below function that loops through the selection objects and gets the field selected and sets it to a global variable:

var fullFields;


function getFilterSelections() {

     var app = qlik.currApp();

     var getFields = app.getList("SelectionObject", function(reply){

          $.each(reply.qSelectionObject.qSelections, function(key, value) {

               fullFields +=  value.qField;

          });

     });

};

The function above sets the fullFields variable to the field selected by the user to be used in further functions.

1 Solution

Accepted Solutions
Luminary
Luminary

Re: How to pass a variable from a getList method to an external function?

Hi Yassin,

fullFields is not a globla variable. Try this:

   var filters =  getFilterSelections(appid, config);

I recommend you Google how to call variables from other functions in JS.

Juan

3 Replies
Luminary
Luminary

Re: How to pass a variable from a getList method to an external function?

Hi Yassin,

fullFields is not a globla variable. Try this:

   var filters =  getFilterSelections(appid, config);

I recommend you Google how to call variables from other functions in JS.

Juan

materysaudie
New Contributor

Re: How to pass a variable from a getList method to an external function

Thanks for your reply Juan, I have now edited the above code and it works accordingly. It is now i guess more of an informational thread rather than a question.

Luminary
Luminary

Re: How to pass a variable from a getList method to an external function

Please mark the thread as helpful/answered.

Regards,

Juan