Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
Not applicable

case when not 'attr1' is null implementation in script

How to implement the below in qlickview script

i.e is not null concept in qlik view script

case  when not  ATTR1 is null then ATTR1

when not ATTR2 is null then ATTR2

when not ATTR3 is null then ATTR3

else 'N/A' end  "Hold_Reasons"

1 Solution

Accepted Solutions
sivarajs
Valued Contributor II

Re: case when not 'attr1' is null implementation in script

if(not isnull(ATTR1 ),ATTR1 ,

if(not isnull(ATTR2 ),ATTR2,

if(not isnull(ATTR3 ),ATTR3,'N/A')))

or

if(isnull(ATTR1 )<>-1,ATTR1 ,

if(isnull(ATTR2 )<>-1,ATTR2,

if(isnull(ATTR3 )<>-1,ATTR3,'N/A')))

4 Replies
sivarajs
Valued Contributor II

Re: case when not 'attr1' is null implementation in script

if(not isnull(ATTR1 ),ATTR1 ,

if(not isnull(ATTR2 ),ATTR2,

if(not isnull(ATTR3 ),ATTR3,'N/A')))

or

if(isnull(ATTR1 )<>-1,ATTR1 ,

if(isnull(ATTR2 )<>-1,ATTR2,

if(isnull(ATTR3 )<>-1,ATTR3,'N/A')))

Not applicable

Re: case when not 'attr1' is null implementation in script

It's working thank you

multiview
Contributor II

Re: case when not 'attr1' is null implementation in script

I use this syntax :

IF(LEN(TRIM(ATTR1))=0,ATTR1,
IF(LEN(TRIM(ATTR2))=0,ATTR2,
IF(LEN(TRIM(ATTR3))=0,ATTR3,'N/A'))) AS Hold_Reasons

This will work for blank spaces and null values.

I hope this helps!

Regards

MultiView

richard_pressan
Contributor

Re: case when not 'attr1' is null implementation in script

You should replace '=' by '<>'. Otherwise, you obtain only NULL values..

You should even write:

if( Len(Trim(_)) , ATTR? , ... )

Community Browser