Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Mattia
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
Yousef_Amarneh
Partner - Creator III
Partner - Creator III

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
Yousef_Amarneh
Partner - Creator III
Partner - Creator III

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
Mattia
Creator II
Creator II
Author

Thx Yousef!!!

Now it works perfectly.

Mattia

sunny_talwar

You can also try

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