An expression may include operators, standard and user-defined functions, calculated fields, predefined variables, database fields, constant values and parentheses.
Operators and functions must be used with operands of the correct data type. Consider the formula expression:
"STATISTICS FOR: " CONCAT REGION.NAME
In this formula, CONCAT joins two character fields to give one character field. "STATISTICS FOR: " is, of course, a character string. It is essential that REGION.NAME is also a character field. If it were another type, such as integer, Report Writer would reject the formula.
The operators obey the normal algebraic precedence rules. In summary, the ABS is evaluated first, then MOD, *, / and then +, -. Operations of the same priority are performed from left to right. The normal precedence can be overridden using round brackets, so:
MATERIAL.QUANTITY.IN_STOCK - ORDER_LINE.QUANTITY * PRICE
means 'multiply PRICE by ORDER_LINE.QUANTITY and subtract from MATERIAL.QUANTITY.IN_STOCK'.
(MATERIAL.QUANTITY.IN_STOCK - ORDER_LINE.QUANTITY) * PRICE
means 'subtract ORDER_LINE.QUANTITY from MATERIAL.QUANTITY.IN_STOCK and multiply the result by PRICE'.
To include comments with your expressions use the comment delimiters { }. For example:
(1 + VAT_RATE) * PRICE
{VAT_RATE is a calculated field that equals a decimal fraction}