Expressions

Last update: Edit

1 Introduction

Expressions can for example be used to change a member of an object based on logic.

Named items in the microflow (for example objects, lists, or variables) can be called in an expression by inserting the name of the item and adding a dollar sign (for example, $customer could refers to an object named customer).

Attributes and associations of objects are accessed using a slash (for example, the Name attribute of the customer object is referred to as $customer/Name, and the CRM.Customer_Order association of the customer object is referred to as $customer/CRM.Customer_Order).

Expressions can contain several operations which are applied using standard algebraic rules for precedence and associativity (for example, 1 + 2 + 3). Brackets can be used to change the precedence and associativity, or for clarity.

1.1 Example

As an example, imagine an object called package with two attributes: weight (decimal) and shippingCosts (decimal). The rule is that, 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 the shippingCosts attribute is:

if $package/weight < 1.00 then 0.00 else 5.00`

An overview of the operators which can be used in expressions is shown below.

1.2 Regular Expressions

For details on regular expressions, sub-expressions, and quantifiers, see Regular Expressions.

2 Unary Expressions

3 Arithmetic Expressions

4 Relational Expressions

5 Special Checks

6 Boolean Expressions

7 If Expressions

  • if – performs a conditional action

8 Mathematical Function Calls

  • max – the maximum of a list of numbers
  • min – the minimum of a list of numbers
  • round – the rounding of a floating-point number, optionally to a specified precision
  • random – random number generation
  • floor – the rounding of a floating-point number down
  • ceil – the rounding of a floating-point number up
  • pow – the exponentiation
  • abs – the absolute value

9 String Function Calls

  • toUpperCase – converts the string to upper-case
  • toLowerCase – converts the string to lower-case
  • length – the string length
  • substring – gets a part of a string
  • find – gets a sub-string position
  • findLast – gets the last sub-string position
  • contains – contains the sub-string
  • startsWith – determines whether a string starts with the specified sub-string
  • endsWith – determines whether a string ends with the specified sub-string
  • trim – removes the leading and trailing whitespace
  • isMatch – matches a regular expression
  • replaceAll – replaces the occurrences of a sub-string
  • replaceFirst – replaces the first occurrence of a sub-string
  • String concatenation ( + ) – concatenates strings
  • urlEncode – converts a string to be used in a URL
  • urlDecode – converts a string back from a URL

10 Date Creation

  • dateTime – creating a date value using the server’s calendar
  • dateTimeUTC – creating a date value using the UTC calendar

11 Between Date Function Calls

12 Add Date Function Calls

13 Trim to Date

14 To String

See To String for details.

15 Parse Integer

See Parse Integer for details.

16 Parse/Format Decimal Function Calls

17 Parse/Format Date Function Calls

18 Enumerations in Expressions

  • getCaption – gets the caption of an enumeration value in current language
  • getKey – gets the technical name of an enumeration value