An expression is a valid combination of attributes and/or variables, constants, operators, functions, methods, etc. When executed, it returns a value whose data type matches the data type that receives the value.
For example, you can define an expression composed of:
- Only a fixed value, an attribute, or a variable.
- A method or consecutive methods applied to an attribute or a variable.
- Nested functions.
- A Procedure that returns the value.
- An Inline formula that returns the value.
- A combination of the above examples, etc.
1) &RoundedNumber = &Number.Round(0)
&RoundedNumber (variable based on the Numeric data type with no decimals) receives the result of applying the Round method to the &Number variable (also based on the Numeric data type but it accepts decimals).
2) &FinalPrice = &Price * 0.85
&FinalPrice (variable based on the Numeric data type) receives the result of executing the multiplication of the &Price variable by a fixed number.
1) &CustomerSurnameAndName = CustomerSurname + " " + CustomerName
This expression concatenates the contents of CustomerSurname (attribute based on the Character/VarChar/LongVarchar data type) with a space and the contents of CustomerName (attribute based on the Character/VarChar/LongVarchar data type). The result is assigned to the &CustomerSurnameAndName variable based on the VarChar data type.
2) &String = &Number.Round(0).ToString()
&String (variable based on the Character/VarChar/LongVarchar data type) receives the result of applying the Round method to the &Number variable (Numeric(10.2)) and converting that rounded number without decimals to a string.
1) &ExpirationDate=&Today.AddMonths(1)
&ExpirationDate (variable based on the Date data type) receives the result of applying the AddMonths method to the &Today variable.
Note: While the above examples assign expressions to variables, the result of an expression can be also assigned to an attribute depending on the
object and the object section where you are writing the definition.