Gate Operator

Estimated Reading Time:  8 minutes

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 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 ', $, #, &amp. 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.

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 Module Editor:

Here's how a completed use case looks in the Express View

What You'll Need

To set up this use case, you’ll need:

  • 2 Text Field components

  • 1 Radio Buttons component

  • 1 Data Workflow component

To set up your Data Workflow, you’ll need:

  • 2 Input operators

  • 1 Gate operator

  • 1 Console operator

  • 1 Output operator

Configure the Text Field Components

First, add 2 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 Editor, drag and drop 2 Text Field components onto your canvas.
2. Enter the following Property IDs and Label Text:

Property ID

Label Text

gateArg

Please enter your username

gateOutput

Is this the username you'd like to use?

3. Click Save.

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 first Text Field component.
2. In the Property ID field, enter gateArg.
3. In the Label Text field, enter Confirm your username submission?.
4. Set the Option Label and Value to Store in Submission Data as shown below:

Option Label

Value to Store in Submission Data

Yes

Yes

No

No

5. Set the Horizontal Layout toggle to ON.

6. Click Save.

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 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)

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. Save your Data Workflow.

You can preview the module in Express View with the DevTools Console 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.

Editing a Gate Operator's Settings

You can revisit and make changes to this operator.

1. Click the Data Workflow component.

A 5-button toolbar displays above the component on hover-over.

2. Click the (Settings) button to open the Data Workflow canvas.
3. Click the operator to open its Info Window.
4. Make changes to the operator's settings as needed.
5. Click Save.
6. Save your module.

Copying a Gate Operator

You can make a copy of your operator using familiar keyboard settings. You can copy and paste an exact copy of your operator, matching all settings.

1. Hover over the Data Workflow component.

A 5-button toolbar displays above the component on hover-over.

2. Click the (Settings) button to open the Data Workflow canvas.
3. Click the operator you want to duplicate.
4. On your keyboard, press Command + C (Mac OS) or Ctrl + C (Windows/Linux) to copy the operator.

TIP  You can copy more than one operator at a time. Hold Command or Ctrl on your keyboard and click all the operators you want to copy. Follow the rest of the steps as usual.

5. On your keyboard, press Command + V (Mac OS) or Ctrl + V (Windows/Linux) to paste the copied operator(s) to the Data Workflow canvas.
6. Click Save.
7. Save your module.

TIP  Did you know you can copy an operator and paste it into a different Data Workflow? You'll use the same steps outlined above.

Removing a Gate Operator

Lastly, you can delete this operator from your Data Workflow canvas. You can also use these same steps to delete a connection between two operators.

1. Hover over the Data Workflow component.

A 5-button toolbar displays above the component on hover-over.

2. Click the (Settings) button to open the Data Workflow canvas.
3. Click the operator you want to delete.
4. On your keyboard, press Delete.

NOTE  Once you delete this operator, make sure to connect your remaining operators. If your Data Workflow path doesn't end with an Output or Console operator, your Data Workflow won't work. So, once you delete an operator, make sure to update any remaining paths to end at an Output or Console operator.

5. Click Save.
6. Save your module.

Resources

Lab

You can view this complete use case here: https://training.unqork.io/#/form/602ee09168ad5a1217624617/edit.