NVL
Allow to return the first element if non NULL
otherwise the second.
Inspired from NVL
SQL function.
Usage
Take non NULL object
C_VARIANT($value;$Obj;$NullObject)
$Obj:=New object()
// ...
$value:=NVL($NullObject;$Obj) // $value eq. $Obj (same as Choose($NullObject=Null;$Obj;$NullObject) )
For each without checking if NULL
C_VARIANT($value;$Obj)
$Obj:=New object(... // create your object
For each ($value;NVL ($Obj.collection;New collection))
// do something
End for each
💡 For more than one parameter you can use COALESCE
Explanation
It’s just a simple wrapper on Choose
method.
$0:=Choose($1=Null;$2;$1)
see NVL
Test
see test_NVL