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: 
Not applicable

qlik case statement

Hi Guys,

I am new to Qk sense and need some help with wiring a Case statement.

I am looking to change SQL syntax to Qlik

case when ('feild1' NE " ") and ('Feild2' NE " ") and ('feild3' NE " " or field4 NE " ") and ('feild5' NE " " or 'field6' NE . ) and ('field7' NE 12345)then yes else no

(if(feild1 <>'  ',

    if(feild2 > '12345'

IF((feild3 <> ' ' OR field4 <> '  '),

    IF((feild5 <> ' ' OR field6 <> '  '),

 

   'YES',NO')))))

TIA

2 Replies
manas_bn
Creator
Creator

Hi,


Try this:

//Load Temp table

// For first row, "Flag" should be Yes and second row it should be No

Test:

load * inline

[F1, F2, F3, F4, F5, F6, F7

1,2,3,4,5,6,7

' ',' ',' ',' ',' ','.',12345];

//Resident load

load

F1, F2, F3, F4, F5, F6, F7,

// Case Statement Equivalent

if((F1<>' ' and F2<>' ' and (F3<>' ' or F4<>' ') and (F5<>' ' or F6<>'.') and F7<>12345),'Yes','No') as Flag

resident Test;

Result:

F1F2F3F4F5F6F7Flag
1234567Yes
.12345No

Hope this helps.

Manas

satishsure
Contributor
Contributor

Try If loop

Load

If     ('feild1' NE " ") and ('Feild2' NE " ") and ('feild3' NE" " or field4 NE " ") and ('feild5' NE " " or 'field6' NE . ) and('field7' NE 12345),'yes','no' ) as Value,

     ...

FROM ...