Input Switch Operator

Overview

The Input Switch operator lets you alternate between two inputs in the same flow of a Data Workflow. To start, you'll connect two Input-type operators to your Input Switch. Then, you'll set a condition for the Input Switch to determine which set of input data to use. When your condition is True, the Input Switch chooses the input connected to its upper input port, and when your condition is False, the Input Switch chooses the input connected to its lower input port.

In other words, you can think of an Input Switch like a reverse Decision operator. A Decision operator has two possible paths for your data to follow. The Decision uses a condition to determine which path to send your data on. In contrast, the Input Switch operator has one possible path with two potential sources of data. And the Input Switch uses a condition to determine which set of data to send on that path.

NOTE  Input Switch operators only work in a forward direction. So, the operator can't update or edit any data passed to it through its input ports.

You’ll find the Input Switch 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 Input Switch operator looks like, along with its Info window:

A static image displaying the Input Switch operator and its Settings 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.

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.

To use another operator as an argument, connect the operator to the argument port. Then, enter _arg here.

Adding an Input Switch Operator

To show the Input Switch operator in action, let's look at a simple example. Say you have two Text Fields, and you can use data from either of them in your Data Workflow. You can add a set of Radio Buttons to let your end-user choose which field runs through your Data Workflow. You'll connect both Text Fields as inputs to an Input Switch. Then, you'll connect your Radio Buttons to the argument port of the Input Switch. You'll configure your Data Workflow to show your end-user's selection in a third Text Field.

NOTE  These instructions assume you have a new module open, saved, and with a title.

NOTE  This is a simplified example to demonstrate the functionality of this operator. For a more detailed use case, reference our Input Switch Use Case: Creating a Comment Array article.

Here's how the completed use case will look in the Module Builder:

A static image displaying the Input Switch operator use case configuration in the Module Builder.

Here's how the completed use case will look in Express View Express View is how your end-user views you application. Express View also lets you preview your applications to test your configuration and view the styling. This is also the view your end-users will see when interacting with your application. After configuring a module, click Preview in the Module Builder to interact with the module in Express View.:

Configure the Columns Component

Your Columns component acts as containers for the components that follow.

1. Drag and drop a Columns Component Icon Columns component onto your canvas.
2. In the Property ID  field, enter colInputs.
3. Under Formatting, click Two Columns Icon (two columns).

Static image showing the Columns component configuration in the Input Swith operator use case.

4. Click Save & Close.

Configure the Text Field Components

Next, let's add input and output fields to your module. You'll use Text Fields to collect your end-user's name and job title. And you'll use a third Text Field to show the output of your Data Workflow.

1. Drag and drop three  Text Field components onto your canvas, placing it in the left-hand column of the colInputs Columns Component Icon Columns component.
2. Enter the following Property ID and Label Text Label Text conveys what the input component is and what information it displays. Enter the purpose of the corresponding component or field. for each component:

Property ID

Label Text

name

Name

jobTitle

Job Title

output

Output

3. Click Save & Close as you add and configure them.

Configure the Radio Buttons Component

To let your end-user choose which input they see, you'll add a Radio Buttons component. You'll set this as the argument for your Input Switch in the next step.

1. Drag and drop a Radio Buttons icon Radio Buttons component onto your canvas, placing it in the right-hand column of the colInputs Columns Component Icon 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 switchArgument.
3. In the Label Text field, enter Show:.
4. Set your Option Label and Value to Store in Submission Data as shown below:
 

Option Label

Value to Store in Submission Data

1

Name

name

2

Job Title

jobTitle

Static image showing the Radio Buttons Data table configuration in the Input Swith operator use case.

5. Click Save & Close.

Configure the Data Workflow Component

Now let's add your Data Workflow. You'll set your Name and Job Title fields as inputs for your Input Switch operator. Your Radio Buttons component serves as the argument. Then, your Input Switch outputs the result to your Output Text Field.

1. Drag and drop a Data Workflow Icon Data Workflow component onto your canvas, placing it below your colInputs Columns Component Icon Columns component.
2. In the Canvas Label Text and Property Name fields, enter dwfSwitch.

Static image displaying the Data Workflow configuration for the Input Switch operator.

Configure the First 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

name

Required

No

Source

Default

Configure the Second Input Operator

1. Drag and drop a second Input operator onto your Data Workflow canvas.
2. Configure the Input operator's Info window as follows:

Setting

Value

Category

Input

Component

jobTitle

Required

No

Source

Default

Configure the Third Input Operator

1. Drag and drop a third Input operator onto your Data Workflow canvas.
2. Configure the Input operator's Info window as follows:

Setting

Value

Category

Input

Component

switchArgument

Required

Yes

Source

Default

Configure the Input Switch Operator

1. Drag and drop an Input Switch operator onto your Data Workflow canvas.
2. Configure the Input Switch operator's Info window as follows:

Setting

Value

Category

Input Switch

Label

_arg='name'

Do Not Sanitize Formula

Yes (checked)

Preserve Argument Type

Unchecked (no)

Condition

_arg='name'

3. Connect the output port (right) of the name Input operator to the upper input port (left) of the Input Switch operator.
4. Connect the output port (right) of the jobTitle Input operator to the lower input port (left) of the Input Switch operator.
5. Connect the output port (right) of the switchArgument Input operator to the argument port (top) of the Input Switch 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

output

Action

value

3. Connect the output port (right) of the Input Switch operator to the input port (left) of the Output operator.
4. Click Save.

Configure the Initializer Component

You'll notice this Initializer component performs two operations. First, it clears your Output Text Field so it's ready for a new value each time your Data Workflow runs. Second, it starts the Data Workflow. You'll add a Button component to trigger your Initializer in the next step.

1. Drag and drop an Radio Button component icon Initializer component onto your canvas, placing it above your Data Workflow Icon Data Workflow 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. and Canvas Label Text Canvas Label Text indicates the purpose of the corresponding field or component. For non-input components, the Canvas Label Text isn't end-user facing, and only appears in the . fields, enter initSwitch.
3. Set the Trigger Type Deteremines how the component triggers. as Manual The component fires when the page or called module loads without an existing submission ID. Dashboards and remote execute modules are great uses for this trigger..
4. In the Outputs table, enter the following:
 

Property ID

Type

Value

1

output

clear

yes

2

dwfSwitch

trigger

GO

5. Click Save & Close.

Configure the Button Component

Finally, let's add a Button component to start the whole operation. When your end-user clicks this button, they'll trigger your Initializer. The Initializer then clears your Output Text Field and starts your Data Workflow.

1. Drag and drop a Button component Icon Button component onto your canvas, placing it between your jobTitle and output  Text Field components.
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 btnSwitch.
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 Start Input Switch.
4. Set the Action Type to Event.
5. In the On Click field, enter initSwitch.

Static image showing the Button component's Action Type configuration in the Input Switch operator use case.

NOTE  This ties your Button component to the Initializer component you'll add in the next step. What you enter here must match the Property ID you assign to that Initializer.

6. Click Save & Close.
7. Save your module.

Now it's time to test your Data Workflow. Preview your module in Express View and enter a name and job title. Then, make a selection from your radio buttons and click your button. You'll see the selected value in your Output field.

Resources