Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
MuraliPrasath
Creator III
Creator III

Multiple IF statement Question.

Hi,

I've two fields, "CreditStatus" and "ProdOrder".


I need new field like "SortCodes" with with some if conditions.


CreditStatus   -------------------------------->  SortCodes

- (Null data)                                                  0

B (With No "ProdOrder" data)   give me         1

B (With "ProdOrder" data)   give me              2

A&D ( With No "ProdOrder" data)   give me   3

A&D ( With "ProdOrder" data)   give me        4


I tried following but not worked. Need help!

if(match(CreditStatus,' '),'0',(if(match(CreditStatus,'B' and  IsNull(ProdOrder)),'1',

(if(match(CreditStatus,'B' and  (ProdOrder)),'2',

(if(match(CreditStatus,'A' or 'D' and IsNull(ProdOrder)),'3',

(if(match(CreditStatus,'A'or 'D' and  (ProdOrder)),'4'))))))))) as Sortcodes

1 Solution

Accepted Solutions
sunny_talwar

Try this:

If(Len(Trim(CreditStatus)) = 0, 0,

If(CreditStatus = 'B' and Len(Trim(ProdOrder)) = 0, 1,

If(CreditStatus = 'B' and Len(Trim(ProdOrder)) > 0, 2,

If(Match(CreditStatus,'A', 'D') and Len(Trim(ProdOrder)) = 0, 3,

If(Match(CreditStatus,'A', 'D') and  Len(Trim(ProdOrder)) > 0, 4))))) as Sortcodes

View solution in original post

2 Replies
sunny_talwar

Try this:

If(Len(Trim(CreditStatus)) = 0, 0,

If(CreditStatus = 'B' and Len(Trim(ProdOrder)) = 0, 1,

If(CreditStatus = 'B' and Len(Trim(ProdOrder)) > 0, 2,

If(Match(CreditStatus,'A', 'D') and Len(Trim(ProdOrder)) = 0, 3,

If(Match(CreditStatus,'A', 'D') and  Len(Trim(ProdOrder)) > 0, 4))))) as Sortcodes

MuraliPrasath
Creator III
Creator III
Author

thanks Sunny:-)