Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

upaliwije
Contributor II

If Condition

IF(ISNULL(TYPE)=0,'NOT_LEGAL',ELSE,'LEAGL')AS CATEGERY

I have written above code in my script. But It is not working. Can some correct it for me please.

My requirement is if  TYPE is null then the  category   should be 'NOT LEGAL' else 'LEGAL'

1 Solution

Accepted Solutions
northerner
New Contributor III

Re: If Condition

Try:

if(isNull(TYPE), 'NOT LEGAL', 'LEGAL') as CATEGORY

IsNull will return 0 (representing false) is the TYPE field contains a non-null value.  The Qlikview if statement syntax doesn't use the 'else' keyword - comma characters are used to separate the if/then/else parts of the statement.

Hope this helps!

3 Replies
northerner
New Contributor III

Re: If Condition

Try:

if(isNull(TYPE), 'NOT LEGAL', 'LEGAL') as CATEGORY

IsNull will return 0 (representing false) is the TYPE field contains a non-null value.  The Qlikview if statement syntax doesn't use the 'else' keyword - comma characters are used to separate the if/then/else parts of the statement.

Hope this helps!

Not applicable

Re: If Condition

Hi,

It should be like this:

IF(ISNULL(TYPE), 'NOT LEGAL', 'LEGAL') AS CATEGORY

upaliwije
Contributor II

Re: If Condition

Thanks for your reply and the explanation

Community Browser