Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

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
jvitantonio
Specialist III
Specialist III

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

View solution in original post

3 Replies
jvitantonio
Specialist III
Specialist III

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

Anonymous
Not applicable
Author

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.

jvitantonio
Specialist III
Specialist III

Please mark the thread as helpful/answered.

Regards,

Juan