Use NVL in JavaScript

Pentaho Data Integration

Version
9.3.x
Audience
anonymous
Part Number
MK-95PDIA003-15

NVL (replace null value function) lets you replace a null (returned as a blank) with a string in the results of a query.

Select Compatibility mode and use the following code to replace the value of fieldName with the value of 1, if fieldName is null:

var a;
if ( fieldname.isNull() )
{
    a = '0';
}
else
{
    a = fieldName.getString();
}

You can also use:

fieldName.nvl('1');