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

Efficient method for if statement

I am trying to convert sas code to qlikview.  Here is a snippet of the sas code

case when my_template in ('A','B','C') then H21_Dt else . end as temp1 label='Temp1'  This means if template is A or B or C then list the H21 date, else show a blank or .  It will be named temp1 and the label shall be Temp1.  Here is what I  did in Qlikview:

if([my  template] = 'A' or [my template] = 'B' or [my  template]='C',H21_Dt

I did not know how to address the else condition to show blank nor the naming it temp1.  I can probably hande the label in the properties area of a table or list box.  Is there a more efficient syntax instead of using these repeat if statments and how wuld I address the else condition I mentioned?

3 Replies
Not applicable
Author

That is in the script

Load

if match([my template],'A','B','C'), H21_Dt) as Temp1,

...

...

If in the list box, go to the expression in list box and type in the expression.

=if match([my template],'A','B','C'), H21_Dt)

If in a chart

=if(match([my template],'A','B','C'),H21_Dt)

Tick the check box "Suppress when value is NULL"

Anonymous
Not applicable
Author

Hi,

Try below,

LOAD

     If(Match(my_template, 'A','B','C'), H21_Dt, ' ') as Temp1,

     .......

FROM <TABLE>

PS: "Else" part added as a blank in above condition however if you are not adding anything you will get NULL.

jagan
Partner - Champion III
Partner - Champion III

HI,

Try like this

LOAD

*

if(Match([my  template],  'A', 'B', 'C'), H21_Dt, 'Give your else value here') AS Temp1

FROM DataSource;


Note: Replace your else value, if you don't want any value then give Null().


Regards,

Jagan.