Qlik Community

Ask a Question

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
QlikWorld Online 2021, May 10-12: Our Free, Virtual, Global Event REGISTER TODAY
cancel
Showing results for 
Search instead for 
Did you mean: 
materysaudie
Contributor
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
jvitantonio
Luminary
Luminary

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
Luminary

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

materysaudie
Contributor
Contributor
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
Luminary

Please mark the thread as helpful/answered.

Regards,

Juan