Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
Make your voice heard! Participate in the 2020 Wisdom of Crowds® Survey. BEGIN SURVEY
Mattia
Contributor II

If statement with NOT NULL

Hi guys,

i need to modifiy the following expression, because it don't works.

If(Len(Trim([@183:190]<>'')), Mid([@183:190],3,2), Mid([@18:25],3,2))

The output i want is that If(Len(Trim([@183:190] IS NOT NULL, i must see Mid([@183:190],3,2), otherwise Mid([@18:25],3,2).

Please, someone can help me?

Thanks,

Mattia

 

Labels (3)
1 Solution

Accepted Solutions
Highlighted
Partner
Partner

Re: If statement with NOT NULL

I don't know why you are using len(), however, if you want to check if the field is null or not better to use isnull() fundtion

 

If(Trim([@183:190])='' or IsNull([@183:190]), Mid([@18:25],3,2),Mid([@183:190],3,2))

Yousef Amarneh

View solution in original post

3 Replies
Highlighted
Partner
Partner

Re: If statement with NOT NULL

I don't know why you are using len(), however, if you want to check if the field is null or not better to use isnull() fundtion

 

If(Trim([@183:190])='' or IsNull([@183:190]), Mid([@18:25],3,2),Mid([@183:190],3,2))

Yousef Amarneh

View solution in original post

Highlighted
Mattia
Contributor II

Re: If statement with NOT NULL

Thx Yousef!!!

Now it works perfectly.

Mattia

Highlighted

Re: If statement with NOT NULL

You can also try

If(Len(Trim([@183:190])) > 0, Mid([@183:190], 3, 2), Mid([@18:25], 3, 2))