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

Announcements
Save $650 on Qlik Connect, Dec 1 - 7, our lowest price of the year. Register with code CYBERWEEK: Register
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

display contents of table box based on selections made in list box

Hi,

     I would like to display contents of table box based on selections made in listbox, example I would like to display contents of a table box if I select two division ids (ex.division id =1 AND division id=2) at a time, I tried to use the Calculation condition for this but it didn't work, it worked for OR(division id=1 OR division id=2) though. Please help me out I am a beginner.

Thanks in advance! !

15 Replies
Not applicable
Author

snapshot.PNG

So, when I select two division ids at a time (ex Division id 1 and 2) the contents of the table box must be displayed.

Not applicable
Author

Hello Sunny T ,

                      Great! it worked, after searching for a long time, this solution provided me the exact requirement. Thank you, but I didn't understand why the condition is written in that manner, is there any syntax kind of thing to write conditions, could you explain why it's written like that.

Not applicable
Author

Hi Madhuri madhumohan19,

That is an Set analysis.

Set analysis: Is a Query language used in Qlik used to write expressions.

Thanks

Venkat

sunny_talwar

Let break one of this expression into parts and understand what is going on...

SubStringCount('|' & GetFieldSelections(Division_ID, '|', 100) & '|', '|1|') = 1

1st Part -> GetFieldSelections(Division_ID, '|', 100)

This checks what have you selected in Division_ID field. Where second parameter ('|') is the value separate between selections and finally 100 is just the amount of selections it will show before QlikView start showing something like this for example 101 out of 1000 selected. You might not need 100 but depending on how many selections are possible you

can adjust this number upward or downward.

When only 1 selection is made

Capture.PNG

When more than 1 selection is made

Capture.PNG

Also, just for demonstration how it would look if you have a very low 3rd parameter. Replacing 100 with 2 here GetFieldSelections(Division_ID, '|', 2)

Capture.PNG

We don't want this to happen because this won't work with the SubStringCount.

2nd Part -> SubStringCount('|' & GetFieldSelections(Division_ID, '|', 100) & '|', '|1|')

This count the number of times your last parameter repeats in the list ('|1|'). Since GetFieldSelections always display a distinct list of values that are selected, the above expression will give 1 when 1 is selected else it will give 0.


When only 1 is selected

Capture.PNG

When 1 is selected with other selections

Capture.PNG

When 1 is not selected

Capture.PNG

So this combined with the other expression SubStringCount('|' & GetFieldSelections(Division_ID, '|', 100) & '|', '|2|')

will allow your table to be visible when both 1 and 2 are selected. If any of the two expression is 0 the table box won't show up.


I hope this clarify the logic here.

HTH

Best,

Sunny

Not applicable
Author

Thank you for such detailed explanation.

sunny_talwar

No problem at all