Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
alan_grn
Creator II
Creator II

Oracle NVL equivalent in Qlickview

Is there an equivalent funtion to NVL in Qlikview?

10 Replies
Not applicable

Hi,

a way could be:

If(IsNull(CustomerField, 'NN', CustomerField)

Good luck!

Rainer

Not applicable

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?

jonathandienst
Partner - Champion III
Partner - Champion III

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

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Jason_Michaelides
Luminary Alumni
Luminary Alumni

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

CELAMBARASAN
Partner - Champion
Partner - Champion

Not applicable

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


nagaiank
Specialist III
Specialist III

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)

Jason_Michaelides
Luminary Alumni
Luminary Alumni

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

Not applicable

Thanks for this solution.  It fit my needs perfectly.