NullIf and IsNull in Acumatica

Hello everybody,

recently I debugged code of Acumatica, and found following expression:

[PXFormula(typeof (Switch<Case<Where<Add<SOOrder.releasedCntrSOOrder.billedCntr>, 
Equal<PX.Objects.CS.int0>>, SOOrder.curyOrderTotal
Case<Where<Current<SOSetup.freightAllocation>, Equal<FreightAllocationList.prorate>>, 
Add<SOOrder.curyUnbilledOrderTotal
IsNull<Mult<Div<SOOrder.curyUnbilledOrderTotal, NullIf<SOOrder.curyLineTotal, decimal0>>, 
SOOrder.curyFreightTot>, decimal0>>>>, SOOrder.curyUnbilledOrderTotal>))]

I always got scared when I see such kind of expressions. I have a feeling that it was written by somebody who can easily pass zebra puzzle. Unfortunately I'm not such a men. 

While debugging it I needed to have reference for IsNull and NullIf. Below goes description of each one of them:

NullIf<Operand1, Operand2> 

Returns null if Operand1 equals Operand2 and returns Operand1 if the two expression are not equal. Equivalent to SQL function NULLIF.

IsNull<Operand1, Operand2>

Returns Operand1 if it is not null, or Operand2 otherwise.

No Comments

Add a Comment