Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content
Announcements
Gartner® Magic Quadrant™: 15 YEARS A LEADER - GET THE REPORT
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
Luminary Alumni
Luminary Alumni

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
Luminary Alumni
Luminary Alumni

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
Luminary Alumni
Luminary Alumni

Please mark the thread as helpful/answered.

Regards,

Juan