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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Macro Variable To Propoperly Read Field Selections

I am trying to assign multiple field values from a ListBox to a variable using a macro.

Consequently I used:

     ActiveDocument.Evaluate("GetFieldSelections([Source Choice] , ',' 99)")

However when I lookup the relevant variable in the list of QlikView variables, there is nothing assigned (only '-' ).

The above function works for single selection fields though.

What needs to be changed in the syntax ?

Another issue with the above function is that when I deselect the field values, the relevant varaiable still contains the last selection.

Why does the GetFieldSelections function, not read a "null" field selection ?

Also instead of always declaring variables in QlikView then importing them into the macro editor, I tried:

     Set SourcChoiceValue = SourceChoiceTemp = ActiveDocument.Evaluate("GetFieldSelections([Source Choice])")

I get an objectb type error though whether or not I include the leading 'Set' keyword.

What needs to be changed ?

Thanks in advance

1 Solution

Accepted Solutions
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Why are you using a macro instead of a field OnSelect trigger to set the variable? It's much easier to add a Set Variable action with your variable as target and GetFieldSelections([Source Choice] , ',' 99) as value. The OnSelect trigger action will also clear you variable if you clear the selections.

Nulls cannot be selected in Qlikview, so getfieldselections can't ever contain a null.


talk is cheap, supply exceeds demand

View solution in original post

1 Reply
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Why are you using a macro instead of a field OnSelect trigger to set the variable? It's much easier to add a Set Variable action with your variable as target and GetFieldSelections([Source Choice] , ',' 99) as value. The OnSelect trigger action will also clear you variable if you clear the selections.

Nulls cannot be selected in Qlikview, so getfieldselections can't ever contain a null.


talk is cheap, supply exceeds demand