Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
DrB1
Creator
Creator

if isNull or if NOT isNull

I cannot get this to work! I've tried a piece at a time and it works, but not together. What am I doing wrong?

=rNickName&' ' &LastName       (works giving me the rNickName space LastNamej)

=FirstName&' ' &LastName        (works giving me the FirstName space LastName

I am trying to say if the person has an rNickName put rNickName space LastName, if they do not have a rNickName put FirstName space LastName.  I can't get it to work. I've tried both of these:

=if(not isNull(rNickName),rNickName&' ' &LastName,FirstName&' ' &LastName)

=if(isNull(rNickName),FirstName&' ' &LastName,rNickName&' ' &LastName,)

 

Thanks Qlikie Gurus!!!

Labels (3)
1 Solution

Accepted Solutions
Vegar
MVP
MVP

Can it be that `rNickName` is blank and is not null.

=if(len(trim(rNickName))=0,FirstName,rNickName) &' ' &LastName

 

If it is null then try this:

=coalesce(rNickName, FirstName) & ' ' & LastName

View solution in original post

5 Replies
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Something like this can be tricky because an empty string is not null. I find the best solution to be:

Coalesce(EmptyIsNull(rNickName), FirstName) & ' ' & LastName

-Rob
http://www.easyqlik.com
http://masterssummit.com
http://qlikviewcookbook.com

Vegar
MVP
MVP

Can it be that `rNickName` is blank and is not null.

=if(len(trim(rNickName))=0,FirstName,rNickName) &' ' &LastName

 

If it is null then try this:

=coalesce(rNickName, FirstName) & ' ' & LastName

DrB1
Creator
Creator
Author

@Vegar   this is perfect!! =if(len(trim(rNickName))=0,FirstName,rNickName) &' ' &LastName

 

Thank you so much!!!

DrB1
Creator
Creator
Author

I tried the coalesce but couldn't get it to work. Vegar's len trim worked.  What is the difference between Null and Blank? Null isn't zero, right?

Vegar
MVP
MVP

Null is no value. It is not a number nor a string.

With Blank I was referring to an empty string value: '' 

@rwunderlich : I wasn't aware that the EmptyIsNull() function exsists, it looks very handy for cases like this.