Gate Operator
Overview
Sometimes you need to sort through application data to find data that meets a certain criteria. Like the Filter operator, the Gate operator lets you filter your data based on given criteria. If your data doesn't meet the criteria, the Gate operator blocks it. Blocking the data frees up your application to improve performance elsewhere.
Say you build a module that requires an end-user 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. to enter a user name. Suppose you want to transfer an end-user's date of birth from a text field to a data table. Maybe you want to exclude displaying birthdays in October. You can tell the Gate operator to either block or transfer birthdays that are in October.
Similar Data Workflow Operators
The Gate operator is similar to the Filter and Decision operators. Here are the operators compared:
-
Gate operator: Returns only the data that meets your Condition's criteria. If the data doesn't meet your criteria, the Gate operator blocks it.
-
Filter operator: Separates data that meets your Condition’s criteria from data that doesn't. Data that meets your criteria passes down one pathway while data that doesn't meet your criteria passes down another.
-
Decision operator: Also separates data that meets your Condition’s criteria from data that doesn't. The Decision operator differs from the Filter in that it only returns one output. If the input matches the criteria, it takes one pathway. If the input doesn't match the criteria, it takes the other pathway.
What You'll Learn
In this article, you'll learn:
About the Info Window
Here's what the Gate 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. |
Label |
Sets the label for your operator. The label you enter here shows beneath your operator on your Data Workflow canvas. This field is optional, but set a label if you use more than one of the same operator type. A label helps you identify your operators without opening any Info windows. |
Do Not Sanitize Formula |
When this checkbox is clear, the operator does its best to clean up values coming into or defined in the operator. For example, removing special characters. Some of those special characters include ', $, #, &. The operator also cleans up complex values. For example, logically breaking up strings of numbers and letters using underscores. A sample module ID can go from "5f6b4cdfabf886024d4de2d3" to "5f_6b_4cdfabf_886024d_4de_2d_3". Sanitizing improves performance. But, it can also lead to unexpected data behavior. If your Create Field isn't behaving as expected, try selecting this box. When selected, the operator uses your values and expressions as-is. This is best when working with complex values or values that should remain unchanged. By default, this setting is selected, which means the operator doesn't attempt to sanitize. |
Preserve Argument Type |
When selected, this setting ensures the argument data type is respected when the operator executes. |
Condition |
Defines the condition of the Gate based on the argument (_arg) used. When the condition is true, the Gate pushes the input value to the output. When the condition is false, the Gate blocks the Input value. When the Gate blocks a value, the Data Workflow stops. |
Adding a Gate Operator
Now, you'll explore the Gate operator by setting up an application. Your application transfers a user name from one text field to another. The Gate operator lets end-users decide if they want their user name transferred. If the end-user selects the No option, the transfer gets blocked.
Here's how a completed use case looks in the Express View:
Configure the Text Field Components
First, add two Text Field components. The first component collects a username from the end-user. The second displays the username if the end-user chooses to confirm it.
1. | In the Module Builder, drag and drop two Text Field components onto your canvas. |
Property ID |
Label Text |
---|---|
gateInput |
Please enter your username |
gateOutput |
Is this the username you'd like to use? |
3. | Click Save & Close. |
Configure the Radio Buttons Component
Next, add a Radio Buttons component. Configure it so your end-user can select whether they want to confirm their username.
1. | Drag and drop a Radio Buttons component onto your canvas, placing it below the gateInput Text Field 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 gateArg. |
3. | In the Label Text field, enter Confirm your username submission?. |
4. | Set the Horizontal Layout toggle to (ON). |
5. | Set your Option Label and Value to Store in Submission Data as shown below: |
Option Label |
Value to Store in Submission Data |
|
---|---|---|
1 |
Yes |
Yes |
2 |
No |
No |
6. | Click Save & Close. |
Configure the Data Workflow Component
Now, add the Data Workflow component. This component pulls data from your gateInput Text Field and filters it through a Gate operator. You can see the results displayed in the gateOutput Text Field.
1. | Drag and drop a Data Workflow component onto your canvas, placing it below the gateArg Radio Buttons component. |
2. | In the Canvas Label Text and Property Name fields, enter dwfGate. |
Configure the First Data 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 |
gateArg |
Required |
Yes |
Source |
Default |
Configure the Second Data 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 |
gateInput |
Required |
Yes |
Source |
Default |
Configure the Gate Operator
1. | Drag and drop a Gate operator onto your Data Workflow canvas. |
2. | Configure the Gate operator's Info window as follows: |
Setting |
Value |
---|---|
Category |
Gate |
Label |
_arg ='Yes' |
Do Not Sanitize Formula |
Checked (yes) |
Preserve Argument Type |
Unchecked (no) |
Condition |
_arg ='Yes' |
NOTE You'll connect the output port (right) of the gateArg Input operator to the argument port (top) of the Gate operator. The connection passes the Radio Buttons criteria to the Gate operator. The Gate operator blocks the 'No' criteria from the gateArg Input operator.
3. | Connect the output port (right) of the gateInput Input operator to the input port (left) of the Gate operator. |
4. | Connect the output port (right) of the gateArg Input operator to the argument port (top) of the Gate operator. |
Configure the 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 |
Gates _arg='Yes' |
3. | Connect the output port (right) of the Gate operator to the input port (left) of the Console operator. |
Configure the 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 |
gateOutput |
Action |
value |
3. | Connect the output port (right) of the Gate operator to the input port (left) of the Output operator. |
4. | Click Save. |
5. | Save your module. |
You can preview the module in Express View with the DevTools Console The DevTools Console helps you securely store, build, test, and deploy your software. open. Enter sample_User in the first Text Field and select Yes. When you click Yes, sample_User displays in the second Text Field.
In the Console, you can see that the argument passed successfully, and the username you entered.
Resources
-
What's the difference between the Gate, Decision, and Branch Split/Merge operators?
-
Modify the Gate operator in the Data Workflow's configuration window.