Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Shailesh
Contributor II
Contributor II

Selecting items in listbox using variable value

Hi,
I am new to qlik. I have a list box and two variables vStart and vEnd. I need to select items in listbox automatically between vStart and vEnd. For example: List box looks like this: 0 30 60 90 120 If vStart=0 and vEnd=60 then I need to select items 0,30,60. Also variable values are dynamic.
Any idea..
Thanks in advance...
1 Solution

Accepted Solutions
pradosh_thakur
Master II
Master II

if your field is new_field 

 

go to list box -> click on the dropr down -> at the last row there is expression -> 

=if(new_field >= $(vStart) and new_field <= $(vEnd) ,new_field ,null())
Learning never stops.

View solution in original post

4 Replies
pradosh_thakur
Master II
Master II

if your field is new_field 

 

go to list box -> click on the dropr down -> at the last row there is expression -> 

=if(new_field >= $(vStart) and new_field <= $(vEnd) ,new_field ,null())
Learning never stops.
Shailesh
Contributor II
Contributor II
Author

Thanks for quick reply. I have added the expression, now list box items are filtered but not selected. Items are in grey colour, I need to select automatically so that colour of list box items will change to green.
I really appreciate if u can help in this.
Thanks
pradosh_thakur
Master II
Master II

Oh .. I guess i misread 

 

use your field in list box

go to setting -> triggers-> variables-> on change

select your variables and use this to select the fields

=concat(distinct if(new_field >= $(vStart) and new_field <= $(vEnd) ,new_field ,null()),'|')

or

='(' & concat(distinct if(new_field >= $(vStart) and new_field <= $(vEnd) ,new_field ,null()),'|') & ')'
Learning never stops.
Shailesh
Contributor II
Contributor II
Author

I used your first solution (first post) and to select items I have added 'select all' option in layout--->tick use caption---->tick select all option
So that I can click select all to select filtered items.
However in your second solution using trigger when variable value changes list box items are not selecting all the time.

Thank you very much.. 🙂