Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Write Table now available in Qlik Cloud Analytics: Read Blog
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

show Unknown if IsNull(@48) or @48=' '

I used the following:

(if(isnull(@48)='','Unknown',

     if(@48='','Unknown',@48))) AS [Debtor Type],

but it's not picking up all the blank DebtorType.

aka I'm still getting values coming in as blank.

Any ideas why it's not picking up all the blanks?

8 Replies
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

try: if(len(trim(@48))=0,'Unknown',@48) as [Debtor Type]

edit: fixed typo in Debtor Type


talk is cheap, supply exceeds demand
Anonymous
Not applicable
Author

Hi Gysbert,

I tried that, but it didn't work out. Nothing came back at all for DebtorType.

jonathandienst
Partner - Champion III
Partner - Champion III

Hi

Its not working because IsNull() returns a true (-1) or false (0) value. Gysbert's suggestion should work as the length (len) of a null or an empty string is 0.

Regards

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
jonathandienst
Partner - Champion III
Partner - Champion III

[DebtorType] or [Debtor Type]? Did you correct the field name typo in Gysbert's suggestion?

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Anonymous
Not applicable
Author

Hi Jonathan,

when I use Gysbert's script this is the result I get.

Debtor Type.PNG

this is the result when I use the script:

(if(isnull(@48)=' ','Unknown',

     if(@48= ' ','Unknown',@48))) AS [Debtor Type],

DebtorType2.PNG

Anonymous
Not applicable
Author

John,

thanks for noticing the that [DebtorType] need to be changed to [Debtor Type]

when I made that change it is giving the same result as the second table above.


Anonymous
Not applicable
Author

hi chris,

                 Can u provide an app? it wud b easy to rectify...

Anonymous
Not applicable
Author

Well I think you can't use isnull function the way you used.

(if(isnull(@48)='','Unknown',

     if(@48='','Unknown',@48))) AS [Debtor Type],

the correct format of isnull is :

(if(isnull(@48),'Unknown',

     if(@48='','Unknown',@48))) AS [Debtor Type],

or you can use this format :

(if(@48=null(),'Unknown',

     if(@48='','Unknown',@48))) AS [Debtor Type],

I hope this helps!

MultiView