Expressions are the building blocks of PropertyWizard formulas. They are like phrases in a language.
It’s useful to understand the different kinds of expressions in PropertyWizard, so you can put them together in different ways to write better formulas.
There are four main kinds of expression in PropertyWizard:
- Literal expressions
- Identifier expressions
- Operator expressions
- Function expressions
Literal Expressions
Also called ‘literals’, these are where you type a value directly in the formula, such as typing
"Hello Wall"
or
2.5
or
5 sq m
The value of the literal expression is the value you type.
Identifier Expressions
These are the names of properties, such as
Level
or
Level.Name
The value of the identifier expression is the value of the property.
Operator Expressions
These are the expressions that use the standard maths and logical operators like the plus sign:
<number expr> + <number expr>
You can see how this expression contains two <number expr> sub-expressions. It’s a type of Composite Expression, in contrast to the Simple expressions (literal and identifier expressions)
The sub-expressions have to return the right data type – in this case Number data. But they can be any kind of expression – literals, identifiers, operator expressions or functions – that produce that data type in the end. This is how you can build up arbitrarily complex formulas to do exactly what you need.
Function Expressions
Function expressions are all of the form:
<function name>(<zero or more argument expressions separated by commas>)
They provide more complex functionality than operator expressions. Each function defines how many ‘arguments’ it takes, and what their data types should be. And as with operator expressions, each of the arguments can be any kind of expression as long as it produces the right data type.
All function expressions are Composite except pi(), which has no arguments.
How to use expressions
Every formula has to be an expression. If that’s a Simple expression, then that’s all there is. If it’s a Composite expression, then it will contain sub-expressions that may in turn be either Simple or Composite. There’s no practical limit to how complex your expression nesting can get.