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.
naveenchellaara
New Contributor III

Checking for NULL in script

How to check for null values in the script file?

I have a variable.

var1

I need to check whether the value of the variable is null or not.

i tried

IF( $(var1) = Null

then

set Var2 = Blue();

endif

but it is thowing an error.

Regards

Naveenchellaaraam

Tags (1)
1 Solution

Accepted Solutions

Re: Checking for NULL in script

I think the most robust test is

len('$(v1)') = 0

Note the single quotes around the variable.

-Rob

http://robwunderlich.com

4 Replies
nagaiank
Valued Contributor III

Re: Checking for NULL in script

IsNull(X) returns True if X is null.

Also Len(Trim(X)) = 0 if X is null.

http://community.qlik.com/docs/DOC-3155 has more details.

chauhans85
Esteemed Contributor

Re: Checking for NULL in script

try below code .

if(isnull($(var1)),Blue())

or

if(len($(var1))=0,Blue())

or

if(($(var1))=' ',Blue())

hope this helps

phaneendra_kunc
Valued Contributor III

Re: Checking for NULL in script

Try this....

If Len ($(var1)) = 0 then

Set Var2 = 'blue()';

Endif.

Re: Checking for NULL in script

I think the most robust test is

len('$(v1)') = 0

Note the single quotes around the variable.

-Rob

http://robwunderlich.com

Community Browser