The if then else statement is essential to putting together logic in a model. In a DMN model, you can use Friendly Enough Expression Language (FEEL) in the format of an if then else statement and use it at any stage of execution, whether as an expression of a node in a DRD or as part of a boxed expression, decision table, etc.

Open the Interactive Shell

Open FlexRule Designer and be sure the DMN extension is installed. From the top ribbon menu open up the interactive shell to test out FEEL expressions– go to Tools>InteractiveShell

Open ToolsInteractiveShell.png

Open the Interactive Shell

 

Here is the format of if-then-else logic in FEEL:

if condition then result else other-result

Examples of the if-then-else logic in FEEL

Here are some examples you can try out in the shell:

if true then “valid” else “not valid”
result: “valid”

if sum(4, 4, 4) == 12 then "Sum is 12" else null
result: “Sum is 12”

if 3==4 then 'this is cool' else 'what are you talking about?'
result: what are you talking about?

if 1.7|floor() < 1.1 then "floor is less" else "floor is more"
result: “floor is less”

The if then else format can also be represented as a conditional boxed expression.

Summary of the If-Then-Else Structure

In projects with the DMN extension you can use if-then-else logic in FEEL expressions. This can be tested in the interactive shell and used with any logic in your models where a FEEL expression is applicable. For more control structures, take a look at this section of our FEEL expressions Resource Hub article.