
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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?
- Tags:
- new_to_qlikview

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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"

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.

.png)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
