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

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Using Variables in an If Statement

I am trying to create a button that toggles between a selection in a field and then showing all!!

Field - APInv.PayGroup (Data - GP, Local Gov, NHS, Non-NHS, Ophthalmic, Petty Cash, UPR, Utility)

Button 1 - =if(vPayGroup = 1 , 'NHS', '') This is created in Actions > Select In Field > Search String

This button works fine and toggles between showing 'NHS' and showing all

Button 2 - I want this to toggle between showing all and then all except NHS

     I am unsure how to use this in the search string!

Any help would be much appreciated.

thanks

Andrew

1 Solution

Accepted Solutions
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Try:

=if(vPayGroup = 1 , '(' & concat({1<[APInv.PayGroup] -= {'NHS'}>} distinct chr(34) & [APInv.PayGroup] & chr(34) , '|' ) & ')' )


talk is cheap, supply exceeds demand

View solution in original post

4 Replies
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Try:

=if(vPayGroup = 1 , '(' & concat({1<[APInv.PayGroup] -= {'NHS'}>} distinct [APInv.PayGroup] , '|' ) & ')' )


talk is cheap, supply exceeds demand
Not applicable
Author

This a good start thank you.

Unfortunately this is missing out 'Local Gov' & 'Petty Cash'!! I have checked the data to make sure that there is data to be shown and there is!!

Any suggestions?

Andrew

Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Try:

=if(vPayGroup = 1 , '(' & concat({1<[APInv.PayGroup] -= {'NHS'}>} distinct chr(34) & [APInv.PayGroup] & chr(34) , '|' ) & ')' )


talk is cheap, supply exceeds demand
Not applicable
Author

That's great, it's now working fine.

Thanks gysbert, mucha appreciated.

Andrew