Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Highlighted
anonymous1
New Contributor III

IF NULL THEN... syntax

hi guys, 

im wondering if you can help me, i believe i may have my syntax wrong for this 'if...null' expression.

im creating a list box, i want it to have 2 options: Exists or Does Not Exist:

=IF (IsNull([DATE], 'Does Not Exist', 'Exists')

basically, in the data, if the date is null then the inventory doesn't exist, otherwise it does exist. this statement does not work.  anyone have any ideas?

regards

1 Solution

Accepted Solutions
trdandamudi
Honored Contributor II

Re: IF NULL THEN... syntax

Can you please give a try on the below expression and see if it works:

=IF (Len([DATE])>0, 'Exists' , 'Does Not Exist')

6 Replies
bharathadde
Contributor II

Re: IF NULL THEN... syntax

I think you forgot to include bracket after Date

=IF (IsNull([DATE]), 'Does Not Exist', 'Exists')

if above doesn't work then use below

=IF (Len([DATE])>0, 'Exists', 'Does Not Exist')

trdandamudi
Honored Contributor II

Re: IF NULL THEN... syntax

Can you please give a try on the below expression and see if it works:

=IF (Len([DATE])>0, 'Exists' , 'Does Not Exist')

acsaggar
New Contributor II

Re: IF NULL THEN... syntax

Hi Anonymous 1
What output are you getting? You should be able to do this in a list box.
Alternatively, you can try putting this expression in the script and aliasing it
e.g.
if(isnull([Field]),'Does not exist', 'Exists') as Existence

then create a list box using the field 'existence'
simply taking
=if(isnull([Date]),'Does not exist', 'exists')
seems to work for me. What output do you get? just a blank list box? please also check that the field name is correct and the field is populated
anonymous1
New Contributor III

Re: IF NULL THEN... syntax

hi,

thanks to everyone for the responses, this seems to have worked.  however, the 'Does Not Exists' option (i.e. all the NULLs) remains grey and never lets me select this.  any idea why that would be?

anonymous1
New Contributor III

Re: IF NULL THEN... syntaxhi,

hi, 

the 'Does not exists' option now remains permanently grey, and wont let me select it.  any ideas why that would be?

trdandamudi
Honored Contributor II

Re: IF NULL THEN... syntaxhi,

That is because your date is null/space and you cannot filter on null/space in qlikview.