Mendix 7 is no longer supported unless you have Extended Support (for details, please contact Mendix Support). Mendix 7 documentation will remain available for customers with Extended Support until July, 2024.

Expressions

Last modified: April 9, 2024

Expressions can for example be used to change a member of an object based on logic. Variables in the microflow can be called in an expression by inserting the name of the variable and adding a dollar sign. E.g. $customer refers to the variable customer. Expressions can be used recursively, for example, 1 + 2 + 3. Attributes and associations of object variables are accessed using a slash, for example, $customer/Name, $customer/CRM.Customer_Order.

To illustrate this imagine an object with variable name package with two attributes: weight (Float) and shippingCosts(Decimal). Rule: if the weight of a package is less than one kilogram there are no shipping costs. Otherwise the shipping costs are €5.00. The expression for changing attribute shippingCosts is: if $package/weight < 1.00 then 0.00 else 5.00.

An overview of the possibilities with expressions can be found below.

Unary Expressions:

Arithmetic Expressions:

Relational Expressions:

Special checks

Boolean expressions

If expressions

Mathematical function calls

  • max - Maximum of a list of numbers
  • min - Minimum of a list of numbers
  • round - Rounding a floating-point number, optionally to a specified precision
  • random - Random number generation
  • floor - Rounding a floating-point number down
  • ceil - Rounding a floating-point number up
  • pow - Exponentiation
  • abs - Absolute value
  • floatsEqual / currenciesEqual - Equality of floats/currencies for a certain precision (deprecated)

String function calls

Date creation

  • dateTime - Creating a date value using the server’s calendar
  • dateTimeUTC - Creating a date value using the UTC calendar

Between date function calls

Add date function calls

Trim to date

To string

To float (deprecated)

Parse integer

Parse/format float function calls (deprecated)

Parse/format decimal function calls

Parse/format date function calls

Enumerations in expressions

  • getCaption - Get caption of enumeration value in current language
  • getKey - Get technical name of enumeration value