About the rule expression language

Use the rule expression language to create the expression component of a data-entry rule, workflow rule, or global condition.

You create rule expressions in:

  • The Expression tab of the Rule Wizard.
  • The Expression workspace of the dialog boxes used to create or edit a workflow rule or global condition.

As you type, a list of the rule model components that you can use in the expression (study objects and their properties, functions, constants, and data mappings) appears in the Expression workspace. When you select a rule model component, a tooltip appears to indicate its usage (for example, the parameters and their data types required for using a function). The list changes dynamically to support the contents of the expression as you create it.

You can also use the following methods for creating a rule expression:

  • Drag rule model components into the Expression workspace from the tabs that appear on the right side of the workspace.
  • Type an expression directly in the Expression workspace.

A rule expression can include any valid C# expression that can appear on the right side of the equals sign (=), including:

  • Operators and literals.
  • Study objects and their rule model properties.
  • Functions.
  • Constants defined for the study.
  • Data mapping study objects and their rule model properties.
  • Methods. You can use any method, including:
    • Math methods.
    • Data set methods.
    • Methods for repeating study objects.

A rule expression cannot include:

  • Complex structures, such as if statements (conditionals are allowed) and looping statements.

    Use functions to build more complex rule expressions. For more information, see Functions tab of the rule wizard.

  • Multi-line expressions.

    The rule expression does not allow flow-of-control operators, such as like, if, then, for, or while. You can use parentheses to provide better readability and grouping.

  • Semi-colons in rule comments. If a semi-colon is included, deployment fails.

An expression must evaluate to one of the following types:

  • Integer
  • Float
  • Boolean
  • Text
  • Date time

Note:

A rule expression is similar to a switch statementin C++, C#, or Java.

For more information, see: