Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
apthansh
Creator
Creator

If else condition

Can I put something like below condition ?

=if(GetFieldSelections(Status)='Active','1','A' or

    IF (GetFieldSelections(Status)='Closed','2','B' or

        IF  (GetFieldSelections(Status)='Pending','3','C' )))

Is anything wrong in the above condition ?It doesn't work..

6 Replies
sunny_talwar

Yes, the above isn't right because you have a true and false condition, but you are not ending your if statement

=if(GetFieldSelections(Status)='Active','1','A' or

    IF (GetFieldSelections(Status)='Closed','2','B' or

        IF  (GetFieldSelections(Status)='Pending','3','C' )))

Green is True, Red is False... it will show you an error after this

Peter_Cammaert
Partner - Champion III
Partner - Champion III

In addition to what Sunny already pointed out, there are too many options for some Status values.

For example, If Status = 'Closed' then the result can either be 'A' (because not 'Active') or '2' (because of the next IF). Which will it be?

apthansh
Creator
Creator
Author

thank you...how can i correct this ?is there a solution ?

Peter_Cammaert
Partner - Champion III
Partner - Champion III

Not really, because it isn't clear what value should go with which Status Code. Can you provide a table with two columns with in the rist column all Status codes (and a default entry for all other cases), and in the right column the corresponding expression result values. Then we can fix it.

effinty2112
Master
Master

Hi Ansh,

I can only guess what you're looking for but maybe this?

=if(GetFieldSelections(Status)='Active',Dual('A',1),

    if(GetFieldSelections(Status)='Closed',Dual('B',2),

       if(GetFieldSelections(Status)='Pending',Dual('C',3)))

Regards

Andrew

its_anandrjs

What about this if it matches with your requirement also check values after this may be it works.

=if( GetFieldSelections(Status)='Active','1' or GetFieldSelections(Status)='Active','A' or

if( GetFieldSelections(Status)='Closed','2' or GetFieldSelections(Status)='Closed','B' or

IF( GetFieldSelections(Status)='Pending','3' or GetFieldSelections(Status)='Pending','C' )))