Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

isNull() does not Work

I have a list of receptnumbers and from this list I select the changes in the Recept with this Formula


if(isnull(Recipe), null(),if(Recipe = previous(Recipe), 0, 1)) as RecipeChange.
[/ncode]
I need a expression which gives me the following.
1) If I select month and date, I need the first Number to be always 1.
2) Another problem is that all the Numbers are not filled in the Databank. If there are no Numbers it must still consider it as a change i.e value must be 1
For ex.. In the Recept Number Field The first one is 1 and after that if the number is equal to previous Number the change is 0 and if it is not equal then 1. Even though there is a blank or nothing it must take as a seperate Change. The First in the list is automatically 1. I hope I am clear.
<table><col></col> <col></col> <tbody><tr><td>Recept Numbers</td><td> Recept Change</td></tr><tr><td>12345</td><td>1</td></tr><tr><td>12345</td><td>0</td></tr><tr><td>-</td><td>1</td></tr><tr><td>12345</td><td>1</td></tr><tr><td>12346</td><td>1</td></tr><tr><td>12346</td><td>0</td></tr></tbody></table>

3) If the Number changes from null() to RezeptNumber this formula works but when It changes from Number to Null(). This does not work.

Ideas are appreciated. Thanks in Advance
Sravan
</body>
6 Replies
Not applicable
Author

Any one..can you help me..

Not applicable
Author

Maybe it is not null. Maybe it's 0 or a blank string like this ''. Try to check a length of the value.

Not applicable
Author

Hi Nick ,

If it is a blank like you said. How can I change the code so that It may give me correct result.

Thanks for your answer.

Not applicable
Author

There are issues with 64bit and null so always use len() to test for null for portability:

if (len([field name]) = 0, x, y)

Regards,

Gordon

Not applicable
Author

hello Gordon,

Thanks.. so what can the formula be..

if(len(Recipe) = 0, 'None', if(Recipe = Previous(Recipe), 0 ,1) as Recipe change. This does not work. Why I dont get None in my Recipe, I dont understand Surprise

Not applicable
Author

Then your data is not null. Does it just contain spaces (spaces are as much a character as 'a' or anything else dont forget)? If you want to count a field full of spaces as empty then use this where trim removes both leading and trailing spaces:

if(len(trim(Recipe)) = 0, .....

Regards,

Gordon