function returns one of two patterns
based on expression value. It has the following parameters:
- Pattern 1 (expression is "true")
- Pattern 2 (expression is "false")
- The engine uses 0 and negative integer values as 'false' and other integers as 'true'. It converts float values to integer by truncating: '0.9' and '-9' are 'false'.
- If the expression contains '(' and ')' please add extra brackets for whole expression.
- We do not recommend to use string, date or time values as condition directly. Please compare it with another value instead.
- $If(@'CustomerID'>255,null,255) means 'null' if 'CustomerID' column greater then 255 or 'null' otherwise.
- $if(((@'ID'>=2) & (@'ID'<8)),10,0) generates 10 for 'ID' between 1 and 8 (i.e. 2,3,4,5,6,7) and 0 otherwise.
- $If(@'CustomerName'='null',$CALL(COMPANY),0) means 0 if 'CustomerID' column contains 'null' string or use named generator COMPANY otherwise.