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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Conditional Expression based on List Boxes

I need some advice, I have a list box that has three values from an inline table:

100   Other

200   Purchase

300   Rental

I sum a monetary field and create a total for each of these values, so the table looks like this

Purchase      Rentals   Other     Total

###$            ###$      ###$      ###$

If the user selects Other I only want the Other and Total columns to show, If a user selects Purchase and Rentals I want only Purchase, rental and Total columns to show but NOT other.

What happens is if the user select one of the list choices only that field shows, I can also get all of them to show when nothing is selected by using getselectedcount = 0.  What I can't get is two of the fields to show.  So if a user selects BOTH purchase and rentals nothing shows. Is there a way to get this to work ?

Labels (1)
1 Solution

Accepted Solutions
Carlos_Reyes
Partner - Specialist
Partner - Specialist

You can use SubstringCount. For instance, the conditional for the Purchase expresion would be the next:

SubstringCount( Concat ( Field, ' | '), 'Purchase')

If you want to make sure that Purchase is selected then you only have to add the GetSelectedCount function

SubstringCount( Concat ( Field, ' | '), 'Purchase')   AND GetSelectedCount( Field ) >=1

View solution in original post

2 Replies
Carlos_Reyes
Partner - Specialist
Partner - Specialist

You can use SubstringCount. For instance, the conditional for the Purchase expresion would be the next:

SubstringCount( Concat ( Field, ' | '), 'Purchase')

If you want to make sure that Purchase is selected then you only have to add the GetSelectedCount function

SubstringCount( Concat ( Field, ' | '), 'Purchase')   AND GetSelectedCount( Field ) >=1

Not applicable
Author

Thank you Carlos, it worked like a charm !