New Operators in the Genus Application Framework Language

Product 12/03/2015 by Jan Petter Bergfjord

The ?? Operator

 

The ?? operator returns the left-hand operand if the operand is not null, otherwise it returns the right hand operand. Basically it is a more compact syntax than writing a conditional expression or using the Misc.ifNull(<check-value>, <replacement-value>) function.

 

Example:

 

Return the value of sales.amount if it is not null, otherwise 0.

 

sales.amount ?? 0

 

which is the same as writing

 

Misc.ifNull(sales.amount, 0)

 

or

 

if sales.amount <> null then

  sales.amount

else

  0

 

The !?? Operator

 

The !?? operator returns the opposite of the ?? operator, that is, it returns the right hand operand if the operand is not null, otherwise null. The operand was introduced to simplify writing expressions in Analysis used for counting objects on an aggregated level.