Qlik Community

Ask a Question

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
Talk to Experts Tuesday, January 26th at 10AM EST: Qlik Sense. REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Creator II
Creator 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
Partner
Partner

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
Partner
Partner

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

Creator II
Creator II

Thx Yousef!!!

Now it works perfectly.

Mattia

You can also try

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