Decision Operator
Overview
The Decision operator is like a fork in the road for your Data Workflow. This operator compares your data against a condition or expression you set, and then the operator decides whether that data meets your criteria. If the data meets your criteria, the operator passes the data through the upper output port, and if the data doesn't match, the operator sends the data through the lower output port. Think of these outputs as True or False statements. The upper output port states, yes, the data meets your criteria (True), and the lower output port states, no, the data doesn't meet your criteria (False). So, you'll connect operators to these outputs based on what you want to happen based on those results.
To configure a Decision operator, you'll set a Condition in the operator's Info window. To do this, you'll enter a statement using <, >, =, >=, or <=. For example, you can check whether an end-user's End-users, also known as Express Users, are the individuals accessing an application through Express View. In most cases, end-users are the customers using the product. income is greater than a certain amount. In this case, your condition might look like A > 100000, where A is your input data and 100000 is the income threshold. In more advanced use cases, you might use an OR statement in your condition. For example, OR(A="a",A="b",A="c"). Here, your operator marks data matching a, b, or c as True while all other data is False.
NOTE Decision operators only pass data through one output port at a time. The output port that doesn't receive data will show as _BLOCKED. And steps connected to the blocked port will not fire.
You can also set a Condition using an argument. For that, you'd connect another operator to the Decision operator's argument port. Then, you'd type _arg in the Condition field.
NOTE To set a Condition using an argument, the argument operator must output either a string or a boolean value. This must match the same format as above, using <, >, =, >=, or <=. In other words, the Condition must either be TRUE or FALSE.
You'll find the Input operator under the Gateways group at the left of the Data Workflow canvas.
What You'll Learn
In this article, you'll learn:
About the Info Window
Here's what the Decision operator looks like, along with its Info window:
And here's a breakdown of each setting in the Info window:
Setting |
Description |
---|---|
Category |
Grayed out and non-adjustable setting indicating the operation type. |
Input List |
This drop-down shows available data sources connected to your Decision's input port. Here, you'll select the Property ID for the data you want your Decision operator to process. This selection should match the Property ID you've selected in your Input operator. NOTE This field is optional. But making a selection here shows a label below your operator. These labels can help to keep your canvas organized. |
Preserve Argument Type |
When selected, this setting ensures the argument data type is respected when the operator executes. |
Condition |
Here, you'll set the expression the operator runs your data against. You'll use <, >, =, >=, or <= to set your expression. You can also use a combination of these set inside an OR statement. For example, OR(A="a",A="b",A="c"). To use another operator as an argument, connect the operator to the argument port. Then, enter _arg here. |
Adding a Decision Operator
To show a Decision operator in action, let's look at an example. You'll create a module that collects an end-user's income. Then, you'll use a Data Workflow to recommend a financial adviser to your end-user based on that income.
NOTE These instructions assume you have a new module open, saved, and with a title.
Here's how the completed use case will look in the Module Builder:
Here's how the completed use case will work in Express View along with a look at the DevTools Console:
Configure the Columns Component
Your columns act as containers for the components that follow.
1. | In the Module Builder, drag and drop a Columns component onto your canvas. |
2. | In the Property ID field, enter colAdviser. |
3. | Under Formatting, click (two columns). |
4. | Click Save & Close. |
Configure the Number Component
To collect the income of your end-user, you'll use a Number component.
1. | Drag and drop a Number component onto your canvas, placing it in the left-hand column of the colAdviser Columns component. |
2. | In the Property ID A Property ID is the unique field ID used by Unqork to track and link components in your module. field, enter income. |
3. | In the Label Text Label Text conveys what the input component is and what information it displays. Enter the purpose of the corresponding component or field. field, enter Current Household Income. |
4. | Set the Currency Formats the value as currency, applying the Prefix, Suffix, and Thousands Separator settings. toggle to (ON). |
5. | Set the Show Thousands Separator toggle to (ON). |
6. | Click Save & Close. |
Configure the Text Field Component
You'll use a Text Field as the output for your Data Workflow. Here, your end-user sees their recommended financial adviser. Since your end-user won't input data here on their own, you'll set this field as read-only.
1. | Drag and drop a Text Field component onto your canvas, placing it in the left-hand column of the colAdviser Columns component. |
2. | In the Property ID A Property ID is the unique field ID used by Unqork to track and link components in your module. field, enter financialAdviser. |
3. | In the Label Text Label Text conveys what the input component is and what information it displays. Enter the purpose of the corresponding component or field. field, enter Recommended Financial Adviser. |
4. | Set the Read Only toggle to (ON). |
5. | Click Save & Close. |
Configure the Data Workflow Component
Now, you'll set up your Data Workflow. You'll use an Input operator to bring in your end-user's income. Then, you'll use a Decision operator to determine which financial adviser to recommend. You'll also include Console operators to see what's happening behind the scenes.
1. | Drag and drop a Data Workflow onto your canvas. Place your Data Workflow below your columns. |
2. | In the Canvas Label Text and Property Name fields, enter dwfFinancialAdviser. |
3. | Set the Trigger Type to Watch. |
Configure the Input Operator
1. | Drag and drop an Input operator onto your Data Workflow canvas. |
2. | Configure the Input operator's Info window as follows: |
Setting |
Value |
---|---|
Category |
Input |
Component |
income |
Required |
Yes |
Source |
Default |
Configure the Decision Operator
1. | Drag and drop a Decision operator onto your Data Workflow canvas. |
2. | Configure the Decision operator's Info window as follows: |
Setting |
Value |
---|---|
Category |
Decision |
Input List |
income |
Preserve Argument Type |
Unchecked (no) |
Condition |
A > 100000 |
3. | Connect the output port (right) of the Input operator to the input port (left) of the Decision operator. |
Configure the First Create Value Operator
1. | Drag and drop a Create Value operator onto your Data Workflow canvas. |
2. | Configure the Create Value operator's Info window as follows: |
Setting |
Value |
---|---|
Category |
Create Value |
Label |
Decision True |
Expression/Value |
"Andrea Matthews" |
3. | Connect the upper output port (right) of the Decision operator to the top port of the Decision True Create Value operator. |
Configure the First Output Operator
1. | Drag and drop an Output operator onto your Data Workflow canvas. |
2. | Configure the Output operator's Info window as follows: |
Setting |
Value |
---|---|
Category |
Output |
Component |
financialAdvisor |
Action |
value |
3. | Connect the output port (right) of the Decision True Create Value operator to the input port (left) of the financialAdvisor Output operator. |
Configure the First Console Operator
1. | Drag and drop a Console operator onto your Data Workflow canvas. |
2. | Configure the Console operator's Info window as follows: |
Setting |
Value |
---|---|
Category |
Console |
Label |
Console Decision True |
3. | Connect the upper output port (right) of the Decision operator to the input port (left) of the Console Decision True Console operator. |
Configure the Second Create Value Operator
1. | Drag and drop a second Create Value operator onto your Data Workflow canvas. |
2. | Configure the Create Value operator's Info window as follows: |
Setting |
Value |
---|---|
Category |
Create Value |
Label |
Decision False |
Expression/Value |
"Rachel Moose" |
3. | Connect the lower output port (right) of the Decision operator to the top port of the Decision False Create Value operator. |
Configure the Second Output Operator
1. | Drag and drop a second Output operator onto your Data Workflow canvas. |
2. | Configure the Output operator's Info window as follows: |
Setting |
Value |
---|---|
Category |
Output |
Component |
financialAdvisor |
Action |
value |
3. | Connect the output port (right) of the Decision False Create Value operator to the input port (left) of the second financialAdvisor Output operator. |
Configure the Second Console Operator
1. | Drag and drop a second Console operator onto your Data Workflow canvas. |
2. | Configure the Console operator's Info window as follows: |
Setting |
Value |
---|---|
Category |
Console |
Label |
Console Decision False |
3. | Connect the lower output port (right) of the Decision operator to the input port (left) of the Console Decision False Console operator. |
4. | Click Save. |
5. | Save your module. |
Now you can test your Data Workflow. Preview your module in Express View and enter a value in your Current Household Income field. You'll see the Recommended Financial Advisor update in real-time depending on your entered income. And if you take a look at the DevTools Console, you'll see the value that doesn't apply to your data shows as _BLOCKED.
Resources
Modify the Decision operator in the Data Workflow's configuration window.