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: 
Not applicable

Listbox - specify which items to show

Hello,

In a listbox can I specify which items to list ? For example the Product dimension has Product A to Product Z but if I only want the user to select from : Product A, Product D, Product K or Product R. Can this be hard-coded in the the expression and how ?

Thanks.

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Where have you put that expression into? You need to use a field expression (on general tab of the list box properties, open the field drop down, then select <Expression> from the bottom of the drop down menu).

I assume you have put the expression in there and not to the expression tab, right?

If the dimension Product holds values as you indicated above, jsaradhi's solution should work.

Instead of the if() statement with the many comparisons, you can also use

=if( Match(Product, 'Product A', 'Product D', 'Product K', 'Product R'),Product)

View solution in original post

6 Replies
Anonymous
Not applicable
Author

to hardcode, use an if condition...something like:

=if(Product='Product A' or Product='Product D' or Product='Product K' or Product='Product R', Product)

clearly, more the number of products you want to display, the longer the condition. a better way would be to create a new field in the script and use the new field in list box.

Not applicable
Author

Thanks for your response. The IF statement did not work - still displays all items. Maybe i'll just create a variable or a new field.

Anonymous
Not applicable
Author

interesting...i just tested it on  my end and it worked...do you think you can share a sample qvw? or post a screenshot of your expression?

Not applicable
Author

Where do you exactly write the condition?

You must do it in the General Tab. In the dropdown of field. There is an option <Expression>, if you click the Edit button it will show an editor, that's the place to put it.

If you write the condition in the Expressions Tab it won't work.

swuehl
MVP
MVP

Where have you put that expression into? You need to use a field expression (on general tab of the list box properties, open the field drop down, then select <Expression> from the bottom of the drop down menu).

I assume you have put the expression in there and not to the expression tab, right?

If the dimension Product holds values as you indicated above, jsaradhi's solution should work.

Instead of the if() statement with the many comparisons, you can also use

=if( Match(Product, 'Product A', 'Product D', 'Product K', 'Product R'),Product)

Not applicable
Author

Thanks Everyone, it worked !

I was putting it in the Expression tab, not the General tab.