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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Martin098
Contributor II
Contributor II

If Condition

Hi folks,

I'm new to Qlik. Example i have below type of data with two columns(field A, field B),

20221030_120901.jpg

 in field B have some 'empty' and '-'values. Here i need a new "field C"  wherever field B have 'empty' and '-' then field C have to show "VEGAN" otherwise it have show  "NONVEGAN".

For this I wrote this code like this,

TMP:

load [Field A],[field B],

If([field B]='' or '-', 'VEGAN','NONVEGAN ') as [field C]

From.......... 

Result is

20221030_121043.jpg

But here the if condition is not working where field B has'-' values. 

Can anyone help me to learn this type cases. 

Thank you in advance. 

Labels (4)
1 Solution

Accepted Solutions
MendyS
Partner - Creator III
Partner - Creator III

Hi @Martin098 

try to use - 
If(len([field B])<2, 'VEGAN','NONVEGAN ') as [field C]

View solution in original post

3 Replies
MendyS
Partner - Creator III
Partner - Creator III

Hi @Martin098 

try to use - 
If(len([field B])<2, 'VEGAN','NONVEGAN ') as [field C]

BrunPierre
Partner - Master II
Partner - Master II

As below

If(Len(Trim([Field B]))=0,'VEGAN','NONVEGAN') as [Field C]

MarcoWedel

If([field B]='' or IsNull([field B]), 'VEGAN','NONVEGAN ') as [field C]