Qlik Community

Qlik Education Discussions

Discussion Board for collaboration related to Qlik Education.

help4qv123
Contributor

Expression Based on User Selection

Hi friends,

I have a scenario like, I have a Straight table and two list boxes . user selects two values in both the list boxes and the chart(straight table) should be shown like. (1st value of listbox1 + 1st value of listbox2) in one expression. next expression will be

(1st value of listbox1 + 2nd value of listbox2) next

(2nd value of listbox1 + 1st value of listbox2) next

(2nd value of listbox1 + 2nd value of listbox2). next

(1st value of listbox1 ) next

(2nd value of listbox1 )

Total 4 expressions should be 1 after the another

I am attaching a sample for your reference. Plz let me know if any clarification. Just want to display expression based on user selected value.

Tags (2)
1 Solution

Accepted Solutions
jzimolong
Contributor II

Re: Expression Based on User Selection

I often have to interrogate list box selections, and I typically use variables to capture these:

I can't open your sample qvw, but you could setup the following three variables and populate them like so.  The field that I'm interrogating below is "ver", so you just switch this to the list box field in your app:

vSelectedVersions:        =GetFieldSelections(ver,', ',20)  - This will list out all the selections in list box, with comma separating
vFirstSelected: =SubField(vSelectedVersions,', ',1)  - This will read the variable above, parsing out the first value in the list
vSecondSelected:           =SubField(vSelectedVersions,', ',2)  - This will read the first variable above, parsing out the second value in the list
Then, play around with displaying these values in Text Box objects or something like that, to come up with the visual you are describing above.  It's not the straight table solution you are asking for above, but you might be able to come up with something using these.
5 Replies
MVP
MVP

Re: Expression Based on User Selection

Something like this then:

2015-01-11 Combinations.PNG

MVP
MVP

Re: Expression Based on User Selection

And if you need to keep the selections so they only affect the table(s) then you could put all of them in an Alernate State...

jzimolong
Contributor II

Re: Expression Based on User Selection

I often have to interrogate list box selections, and I typically use variables to capture these:

I can't open your sample qvw, but you could setup the following three variables and populate them like so.  The field that I'm interrogating below is "ver", so you just switch this to the list box field in your app:

vSelectedVersions:        =GetFieldSelections(ver,', ',20)  - This will list out all the selections in list box, with comma separating
vFirstSelected: =SubField(vSelectedVersions,', ',1)  - This will read the variable above, parsing out the first value in the list
vSecondSelected:           =SubField(vSelectedVersions,', ',2)  - This will read the first variable above, parsing out the second value in the list
Then, play around with displaying these values in Text Box objects or something like that, to come up with the visual you are describing above.  It's not the straight table solution you are asking for above, but you might be able to come up with something using these.
help4qv123
Contributor

Re: Expression Based on User Selection

Thank u...helpful ans....i will try and let you know if any issue....

MVP
MVP

Re: Expression Based on User Selection

This version is an improvement of my first suggestion. It use Alternate State and illustrates how one

could access the dimension value of each dimension in the expression too.

2015-01-11 Combinations 2.PNG

Community Browser