Expression Editor
The Expression Editor is an interface that allows you to define complex expressions (conditions) using the conditional controls such as If, Else If, While, and Do Until. A complex expression is formed by combining simple conditions (rules) with logical operators AND and OR or negating these conditions with logical negation operator NOT.
You can access Expression Editor by clicking the Expression icon on the Flow service step. The Expression icon appears only when you select a conditional construct control in the Flow service step.
Components of Expression Editor
Expression Editor consists of two sections:
-
Expression View
-
Expression Builder
Expression View
The Expression view section displays the conditions defined. Additionally, when you hover the mouse pointer on operator of the condition, the condition's scope is highlighted for easy reference as shown in the following illustration:
Expression Builder
The Expression Builder section allows you to create complex conditions by
defining rules. By default, a rule step is displayed to start with the condition definition. A rule
step consists of Left Operand, Operator, and Right
Operand to define a condition. The operands list the fields available in the Pipeline. You
can group multiple rules to define sub conditions.
Expression Builder contains the following controls that aid you in defining the complex conditions:
- Group-level Controls
- Operator - lists the set of logical operators used to join the rules.
- Add Group - groups a set of rules to define sub conditions.
- Add Rule - displays the fields to define a rule.
- Remove Group - deletes a group (sub condition) from the complex condition.
- Negate Group - reverses a sub condition's meaning. This control is a toggle button control. When you negate a group, the Negate Group button is renamed as Remove Negation and allows you to remove the negation for that group.
- Rule-level Controls
- Add Rule - displays the fields for you to define a rule.
- Negate Rule - reverses a rule's meaning.
- Delete Rule - deletes a rule.
At any time you can either modify or delete a part or whole of the complex condition using these controls.
When you hover on the operands, the complete path of the operand appears.
Creating Complex Expressions
Example
Let us create a complex expression for checking the vaccination slot availability with the following conditions:
- Location is Washington
- Zipcode is 20010
- Vaccine can be either Pfizer, Moderna, or Sputnik
- Age is less than or equal to 45 and slot is available
- Venue is Howard University Hospital
Before you Begin
- Log in to your tenant.
- Ensure that the fields are defined.
Basic Flow
- Go to Flow services.
- Select the project where you want to create the new flow service. You can also create a new project.
- Click Add icon to create a flow service. The Start Creating the Flow service screen appears.
- Provide a name for the flow service. For example,
GetVaccinationSlotStatusand an optional description for the new flow service. - Select a conditional control in the flow service step. For example,
If. -
Click the Expression icon on the conditional flow service step. The Expression Editor screen appears.
Perform the following steps to define a rule:
-
Select a left operand.
-
Select an operator.
-
Select a right operand.
-
- [Optional] Click Add icon or Add Rule. A new rule step is added.
- Repeat the above steps to define more rules as per your requirement.
- Select the operator (group-level) from the And drop-down list to conjunct the previous and new rules. As per the example, rule 2 - Zipcode is 20010 is defined and both are combined with an And operator.
-
Perform the following steps to define a group:
-
Click Add Group. A new rule step appears and is grouped under a separate block.
-
Select the operands and operator to define the rule.
-
[Optional] Click
or Add Rule
(group-level). A new rule step is added to the group. -
[Optional] Select the operator from the And drop-down list (group-level) to conjunct the previous and new rules in the group.
-
Repeat the above steps to define all rules in the group. The sub condition is defined. \
-
As per the example, group 1 - *Vaccine can be either Pfizer, Moderna, or Sputnik*, group 2 - *Age is less than or equal to 45 and slot exists* are defined as follows. The groups and other rules are combined with an **And** operator.
-
Define the rule 3 - Venue is Howard University Hospital as per the example. The expression created is as follows:
-
[Optional] Perform the following steps to remove a rule or rule group:
-
Rule - Click
adjacent to the rule that must be
deleted. The rule is deleted from the complex condition. -
Rule Group - Click Remove Group in the group that must be deleted. The rule group is deleted from the complex condition.
-
TIP You can use the keys Ctrl+Z and Ctrl+Y to undo and redo the delete actions.
- [Optional] Perform the following steps to negate a rule or rule group:
-
Rule - Click
adjacent to the rule that
must be negated. The rule is deleted from the complex condition. -
Rule Group - Click Negate Group in the group that must be negated. The rule group is deleted from the complex condition. The button is renamed as Remove Negation and allows you to remove the negation for that group.
- Click
on the Expression Editor screen. The condition
is added to the flow service step. You can click the down and up arrows in the flow service step to
view and hide the complete expression.
The complex condition is created and you can proceed with the other flow service steps.