Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

If Field is Null return other field value

Hi Guys,

I am trying to bring in data from a table with the below fields in my edit script

Product_Code

Product_Name

Product_DESCR

I only really need the Product_Code and Product_DESCR, however not every Product Code has a Product DESCR.  In the case where there is no product DESCR is there a way to write the script that if the Product DESCR is blank (No Value at all) that the script will return the Product Name as the Product_DESCR?

Thanks,

8 Replies
Not applicable
Author

Try like this

if(isnull(Product_DESCR),Code,Product_DESCR) as data

adamdavi3s
Master
Master

As above, the only change I would make is not to use the isnull function which is a bit sketchy at times!

if(len(Product_DESCR)<1,Code,Product_DESCR) as data

Anonymous
Not applicable
Author

Hi Guys,

Both your examples work well, only change I had to make was the second Product_DESCR needed replaced with Product_NAME

if(len(Product_DESCR)<1,Prodct_Code,Product_Name) as data

if(isnull(Product_DESCR),Product_Code,Product_Name as data

Cheers.

Not applicable
Author

Can you elaborate more,

am not getting what are you asking here

roccosdg
Partner - Contributor
Partner - Contributor

Can you create tiers of this. Example Below:

If [Field A] is null,

     Use [Field B],

If [Field B] is null,

     Use [Field C].

Syntax would be helpful! Thanks

adamdavi3s
Master
Master

if(len(A)>0,A,if(len(B)>0,B,if(len(C)>0,C,'DEFAULT'))) as data

Saravanan_AKS
Partner - Contributor
Partner - Contributor

What if don't defined the 3 part in if condition while using in load statement ..

Ex: if (isnull(item), qty)

whether  will return the item for not null values 

Midastouch365
Contributor II
Contributor II

What if I have multiple parameters to pass in? How will I write that?

In this scenerio, only Product_Code and Product_Descr are passed in. Can I pass more than two parameters?