Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Is there an equivalent funtion to NVL in Qlikview?
Hi,
a way could be:
If(IsNull(CustomerField, 'NN', CustomerField)
Good luck!
Rainer
Correct me if I'm wrong:
If(IsNull([an expression that takes 10 seconds to compute], 'NN', [an expression that takes 10 seconds to compute])
will take 20 seconds to compute: 2 times the expression that takes 10 sec.
Whereas
nvl([an expression that takes 10 seconds to compute], 'NN')
will only take 10?
Hi
If the values are numeric, then Alt() is similar to NVL:
=Alt(expression, 0)
Will return 0 if expression returns a non-numeric (including a null). Only works for numerics though.
Regards
Jonathan
I'm not sure if you're right Nicolas, but you could be. If that is the case, then using MAP...USING would be better:
Map_Nulls:
MAPPING LOAD
Null(),
'NN'
Autogenerate 1;
MAP Field3 USING Map_Nulls;
Data:
LOAD
Field1,
Field2,
YourExpressionThatTakes10SecondsToLoad AS Field3,
etc
FROM....;
The MAP...USING function will replace all Null() values in Field3 at the end of script execution.
Hope this helps,
Jason
If that is the case, then using MAP...USING would be better:
Unfortunately, when I have this kind of need, it's not in the script, but in expressions.
I often have this case, and I often deal with "heavy" expressions, that's why I think the "if" used to precalculate all statements (condition, then expression, else expression) even if some are already used in the same expression.
http://community.qlik.com/ideas/1905
I've already thumbed up for this idea long time ago
NVL(expr1,expr2) function:
If expr1
is null, then NVL
returns expr2
. If expr1
is not null, then NVL
returns expr1
.
Qlikview equivalent is:
If(IsNull(expr1),expr2,expr1)
Hi Nicolas,
I guess it's unfortunate that you find you have to deal with NULL values in your front end. I learnt the hard way to try and avoid using NULLs in any way. I always remove all NULLs in the script, replacing them with something selectable, so the only NULLs I am ever left with in the UI are those created due to missing records in QV joins. If I ever need to use these "Join" NULLs (which isn't often) I would try and do something in the script (maybe another forced join) to get rid of them.
Cheers,
Jason
Thanks for this solution. It fit my needs perfectly.