Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
anonymous1
Contributor III
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

Labels (4)
1 Solution

Accepted Solutions
trdandamudi
Master II
Master II

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

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

View solution in original post

6 Replies
bharathadde
Creator II
Creator II

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
Master II
Master II

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

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

acsaggar
Contributor II
Contributor II

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
Contributor III
Contributor III
Author

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
Contributor III
Contributor III
Author

hi, 

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

trdandamudi
Master II
Master II

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