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

Announcements
Qlik Connect 2026! Turn data into bold moves, April 13 -15: Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
krishna20
Specialist II
Specialist II

Expression in List Box

Hi Friends,

I'm having field TP_YN. It is a flag . By using conditional expression  i need to show Individual , Fleet, Both in list box.

i used the below expression but it doesn't work.Please any one can suggest me how to achieve it.


=if(TP_YN='0','Individual','Fleet','both')


or


pick(Match(TP_YN,'0','0','0'),'Individual','Fleet','Both')


Thanks in Advance


Regards


Krishna

9 Replies
Not applicable

Hi

you have an extra parameter to your if statement there,

should be

If([Condition], [True], False])

you have 'both' which is causing an error

=if(TP_YN='0','Individual','Fleet') should work fine in itself, not sure where the 'both' actually comes in to what you are trying to achieve

hope that helps

Joe

morganaaron
Specialist
Specialist

Are your values 'individual' etc. meant to select something from a certain field? The first statement won't work as you have an If statement with 3 conditions (true, false and an extra one) - but this wouldn't give you what you want anyway, I'm guessing.

What is it you're going to do with the listbox?

krishna20
Specialist II
Specialist II
Author

Hi ,

Ya i applied it already.its working fine.

=if(TP_YN='0','Individual','Fleet'). I need to include 'both ' now in the expression.This list box is a filter.. I need to show three values in the list box as Individual, Fleet, Both. How can we  write for this?


Regards

Krishna


Not applicable

Use the following Exp


if(condition,'Individual',

if(condition,'Fleet','both'))

morganaaron
Specialist
Specialist

If you want to show all 3 at the same time, and it be a filter, you could load a new field from scratch with those 3 options as the field values, then use this field as a conditional show or inside of set analysis or...etc. to get whatever results you're after.

tresesco
MVP
MVP

Perhaps like this?

Screen Shot 01-09-15 at 02.56 PM.PNG

Screen Shot 01-09-15 at 02.56 PM 001.PNG

Not applicable

Sounds like you really want a field in your application for this as a separate linked table with the three possible values within it, linked on the flag field.

Edit: just like the example tresesco has recommended below

sunilkumarqv
Specialist II
Specialist II

try like this

=if(TP_YN='0','Individual',If(TP_YN<>'0','Fleet',If(TP_YN='0'  or TP_YN<>'0','Both'))

Not applicable

try to use nested if as everyone already suggest,understand your condition and then apply if condition

if(TP_YN=0,'Individual',if(TP_YN>0,'Fleet','Both'))