Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Select multiple values in a listbox depending on user selection

I'm using a List Box and the user wants to click on "Lights" and have "Indoor_Lights" and "Outdoor_Lights" automatically selected. And of course the same functionality for "Animals" and "Wreaths" where the additional Indoor_ and Outdoor_ records are automatically selected.

I started down the path of using "Field Event Triggers" but I couldn't figure out how to code for the value that was selected (Animals, Lights, Wreaths).

Stuff.jpg

Thanks for any help!

7 Replies
sunny_talwar

Try this trigger

=If(GetSelectedCount(Stuff) = 1, '(' & Concat(DISTINCT {<Stuff = {"=Only({1}Stuff) Like '*' & Only(TOTAL Stuff)"}>} Chr(34) & Stuff & Chr(34), '|') & ')')

vishsaggi
Champion III
Champion III

Hello Sunny, when you get time can you explain this piece please ?

{<Stuff = {"=Only({1}Stuff) Like '*' & Only(TOTAL Stuff)"}>} 

and what values it holds when i select any value from the list box.

sunny_talwar

Remove the trigger and select Lights to look at the table and text box object... you should get an idea of what it does.... If you still don't, I can explain more....

Capture.PNG

vishsaggi
Champion III
Champion III

I removed the trigger and tried to replicate the same table but i am not getting Outdoor_lights Indoor_lights in the table when i select Lights. Would you mind can you explain Little more. I am trying to put this in text object it is giving 0.

= Only({1} Stuff) Like '*' & Only(TOTAL Stuff)

Anonymous
Not applicable
Author

Thanks Sunny! It works, I appreciate the help. I need some more time to figure out how & why it works!

sunny_talwar

Once you remove the trigger, it is not going to work... but the idea is that once you select Lights, I should be able to concatenate all values which have Lights in it. Once I am able to do that I can trigger on Stuff field to select them... What I wanted you to see was, when you select Lights, you will see that the above expression (in a straight table with Stuff as dimension) gives -1 against Lights, Indoor_Lights, and Outdoor_Lights. I used that to pass into my set analysis which evaluates the Boolean against Stuff field and include those which are true (-1).... Does this make sense?

vishsaggi
Champion III
Champion III

Ahh. Ok. Perfect. Got it. I can see True for all the value with Lights then matching that with Stuff. Brilliant. Thanks for that Sunny.