Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Not applicable

How do I get one value from a field with multiple selections into a variable?


I want to set a value from a field selection into a variables but I am struggling.  I setup a trigger to set the variable 'onSelect' and it works fine, if only one value is selected from the field.

Here is an example of my issue:

Lets say a user searches *word* in the field and selects all the records that contain 'word' in that field my variable now contains just '*word*.  I would like to select just the top value that contains 'word'.

I have experimented with getfieldselections and getcurrentselections to no avail, please advise.



1 Reply

Re: How do I get one value from a field with multiple selections into a variable?

Hi Tyler,

That should be easier than that. I'd first try creating a new variable, say vPossibleValues following these steps:

  • Create a new sheet object, input box
  • In the General tab, create a new variable, vPossibleValues
  • In the Constraints tab, Predefined Values, check listed values and use the following expression. I'm using the comma as the list separator character but depending on your regional settings it may be a semicolon or any other character. Check Ctrl + Shift + Q the Doc column for "List Sep".

=Concat(DISTINCT FieldName, ',')

  • In the same tab, click "Predefined Values Only" and "Predefined Values in Drop-down"
  • Then you can even create a trigger in the Settings menu, Document Properties, Triggers, Field Event Triggers, OnSelect or OnChange, Action, External, Set Variable, vPossibleValues and the same expression as above to refresh when the user makes a new selection.

Hope that helps.

Miguel Angel Baeyens

BI Consultant

Comex Grupo Ibérica