Create If-Then-Else Statements

An If-Then-Else expression is a logical notation that evaluates a test statement. It executes a primary expression if the test is true and a secondary expression if the test is not true. You can also introduce additional test statements using the Add Else If button.

To create a decision with the If-Then-Else logic:
  1. Add a new decision element.
    1. On the Diagram palette, under Decisions select If-Then-Else, and drag it onto the canvas.
    2. Double-click the element to edit its logic. You can also edit the element's logic from the Decision Properties pane. Click the three dots on the element and select Edit to open the Decision Properties pane of the element. In the Decision Properties pane, click Edit Edit icon next to the Name field.
      Click Close Close icon to return to the canvas.
  2. In the if expression field, press Ctrl+Space to view a suggestion list. You can use any decision outputs, variables, functions, and keywords from the list to define expressions in if, then, and else fields. Use the FEEL syntax to define expressions. See Define Expressions with the Friendly Enough Expression Language (FEEL).
  3. If necessary, change the logical notations for then and else fields to create a nested logic. All fields have the expression notation selected by default. Click Change Value Change Value icon and select a different notation from the available options for a particular field. Configure logic for the selected notation.
  4. Changes you make within the decision model are automatically saved and validated from time to time. Errors and warnings, if any, are displayed within the decision panel.

In the following example, the input value of temperature determines the output of the If-Then-Else decision:

Description of dmn-ifthenelse.png follows
Description of the illustration dmn-ifthenelse.png

The following example uses an additional test statement, precipitation > 50, through Else If to determine the final output: