Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Nested IF statement help

Hi All,

I'm trying to do a nested if condition. I want to say if......phone1 is null or phone1 is 'no number' then provide me with the phone4 else phone1.

If(Len(Trim(phone1 )) >0 or phone1 = 'no number', phone4, phone1) as Phone_Number.

Please provide assistance,

Thanks

1 Solution

Accepted Solutions
sunny_talwar

May be this:

If(Len(Trim(phone1)) = 0 or phone1 = 'no number', phone4, phone1) as Phone_Number.

View solution in original post

6 Replies
swuehl
MVP
MVP

If(Len(Trim(phone1 )) =0 or phone1 = 'no number', phone4, phone1) as Phone_Number

Not applicable
Author

Thanks for the reply. Whats the difference between using = compared to > both would eliminate the null wouldn't it?

sunny_talwar

May be this:

If(Len(Trim(phone1)) = 0 or phone1 = 'no number', phone4, phone1) as Phone_Number.

maxgro
MVP
MVP

alt(phone1, phone4) as Phone_Number

alt(case1[ , case2 , case3 , ...] , else)

The alt function returns the first of the parameters that has a valid number representation. If no such match is found, the last parameter will be returned. Any number of parameters can be used.

swuehl
MVP
MVP

If phone1 is an empty string, a string with only spaces or NULL, Len(Trim(phone1)) will return zero.

I think that's what you want to test for, right?

Not applicable
Author

If(Len(Trim(phone1)) = 0 or phone1 = 'no number', phone4, phone1) as Phone_Number.


So when it returns no number even after this function it means both phone1 and phone4 have no number (contains no number on file) for the specific selection in the list box right?


Thanks guys,