Expressions
Template allows you to use expression language to define variables and operations on them. This way you can derive new values and reduce necessary input either from user or external system.
Elements
123
- Number"Peter"
- Constant stringName
- Variable+
- OperatorABS(X)
- Function
Numbers
Numbers and operations with them are handled with highest precision. Acceptable number format is simple: 123.456
- starting with digits, followed by decimal separator and ending with digits again. Decimal part is not mandatory.
Variables
A simple word defines a variable name. It consists of upper or lower case letters and can contain, but cannot start with underscore character.
Valid examples:
Name
email
UnitPrice
order_number
You can define or refer to a variable within an object using dot notation, where .
connects object and variable name. Example:
Address.City
Operators
+
- addition-
- subtraction*
- multiplication/
- division%
- modulo>
- greater than>=
- greater than or equal to<
- lower than<=
- lower than or equal to=
- assignment==
- equal!=
or<>
- not equal
Functions
NOT(A)
- logical negationAND(A, B, ...)
- logical ANDOR(A, B, ...)
- logical ORIF(C, A, B)
- if logical condition C is true, result is A, otherwise BABS(A)
- absolute value of number AMAX(A, B, ...)
- maximum value of values A, B, ...MIN(A, B, ...)
- minimum value of values A, B, ...SIZE(V)
- size of vector VSUM(V, X)
- sum of expression X on vector VSUMC(V, X, F, T)
- conditional sum of expression X on vector V, where expression F has target value TNUM(N, D)
- print number N with D digits, pad with leading zeroesNUM(N, D, P)
- print number N with D digits and P decimal places, pad with leading and trailing zeroesROUND(D, S)
- round decimal number D with S scale, rounding half upREPLACE(A, B, C)
- replace string B with string C in A expressionDATE(D, F)
- print date D in F format (y, M, d, H, m, s)TO_DATE(A, F)
- parse string A to date using format F (y, M, d, H, m, s)DAYS(D)
- convert number of days D to date
Types
Variable types can be boolean, number, string, date, or vector. Default type is string, but other types are inferred based on operations or functions used. For example, A + 3
sets A
to number type, which helps eliminate input errors by forcing number input.
If conflicting types arise, e.g. A + 3
(number) and A + ".pdf"
(string), the more format-strict type (number) will be used.
Was this article helpful?
Yes
No