The Filter operator filters data based on a formula provided by the Creator. When the Data Workflow runs, the operator retrieves all matching data in the data set. For example, if an application asks an end-user a Yes
or No
question, the Filter operator can filter the data to only display Yes
responses.
The Filter operator has two output ports. The upper output port outputs the data matching the criteria. The lower output port outputs data that does not match the criteria.
You can also connect an argument to the argument port of a Filter operator. Doing so lets you sort data based on a dynamic variable. For example, you might have a list of products in a Data Table component. The list of available products may depend on whether your client smokes or not. So, you can add a Dropdown component that offers Yes or No responses. With the Dropdown set as an argument, the operator filters based on the selection.
You’ll find the Filter operator under the Table group to the left of the Data Workflow canvas.
About the Info Window
Learn more about each setting in the Filter operator's Info window:
Setting | Description |
---|---|
Category | Grayed out and non-adjustable setting indicating the operation type. |
Label | Sets the label for your operator, displaying below the 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 cleans values coming into or defined in the operator. For example, removing special characters. Some of those special characters include Sanitizing improves performance. But it can also lead to unexpected data behavior. If your Create Field is not 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 does not attempt to sanitize. |
Preserve Argument Type | When selected, this setting ensures the argument data type is respected when the operator executes. |
Expression | Here, you'll enter the criteria you want to filter your data by. The expression can be a single number, a string, an argument, or a full formula. For example, to find Yes data for the Do you smoke? expression, you'd use this formula: You can also add conditions to a formula. Conditioning your Expression filters your data using Let's say you're retrieving data for citizenship from different countries. You want to identify citizens from the United States of America and Mexico. By using AND, you'll only include those who have citizenship in all of the countries you list. To only accept dual citizens as an input, use this formula: |
Adding a Filter Operator
In this example, you'll create a Data Table component that contains a list of countries. You'll include a column displaying whether a country is part of the EU. Then, you'll set up a Data Workflow to separate countries that are part of the EU from those that are not.
Configure the Data Table Component
First, you'll set up your Data Table component with a list of countries, capitals, and whether they are part of the EU.
In the Module Builder, drag and drop a Data Table component onto your canvas.
In the Property ID field, enter
dtCountries
.In the data table, enter the following:
#
A
B
C
1
country
capital
memberOfEU
2
Afghanistan
Kabul
No
3
Albania
Tirana
No
4
Algeria
Algiers
No
5
Cambodia
Phnom Penh
6
Czechia
Prague
7
Andorra
Andorra la Vella
No
8
Austria
Vienna
Yes
Click Save Component.
Configure the Hidden Components
Before you can add your Data Workflow, add two Hidden components to store the Data Workflow results. Your filterTrue Hidden component contains countries that are part of the EU, and your filterFalse Hidden component contains countries that are not part of the EU.
Drag and drop two Hidden components onto your canvas, placing them below the dtCountries Data Table component.
In each component's Property ID and Label Text fields, enter the following:
#
Property ID
Label Text
1
filterTrue
filterTrue
2
filterFalse
filterFalse
After configuring each component, click Save Component.
Configure the Data Workflow Component
Drag and drop a Data Workflow component onto your canvas, placing it between the dtCountries Data Table and Hidden components.
In the Property ID and Canvas Label Text fields, enter
dwfFilter
.
Configure the Input Data Operator
Drag and drop an Input operator onto your Data Workflow canvas.
Configure the operator's Info window as follows:
Info
Category
Input
Component
dtCountries
Required
Yes
Source
Default
Configure the Filter Operator
Drag and drop a Filter operator onto your Data Workflow canvas.
Configure the operator's Info window as follows:
Info
Category
Filter
Label
Filter Members of the EU
Do Not Sanitize Formula
(checked)
Preserve Argument Type
☐ (unchecked)
Expression
memberOfEU="Yes"
Connect the output port (right) of the dtCountries Input operator to the input port (left) of the Filter Members of the EU Filter operator.
Configure the First Output Operator
Drag and drop an Output operator onto your Data Workflow canvas.
Configure the operator's Info window as follows:
Info
Category
Output
Component
filterTrue
Action
value
Connect the upper output port (right) of the Filter Members of the EU Filter operator to the input port (left) of the filterTrue Output operator.
Configure the Second Output Operator
Drag and drop a second Output operator onto your Data Workflow canvas.
Configure the operator's Info window as follows:
Info
Category
Output
Component
filterFalse
Action
value
Connect the lower output port (right) of the Filter Members of the EU Filter operator to the input port (left) of the filterFalse Output operator.
Click Save Component.
Here's how the completed Data Workflow looks:
Configure the Button Component
Lastly, create a button that the end-user clicks in Express View to trigger your Data Workflow.
Drag and drop a Button component onto your canvas, placing it below the filterFalse Hidden component.
In the Property ID field, enter
btwRunDWF
.In the Label Text field, enter
Run DWF Filter
.Navigate to the Actions settings.
From the Action Type drop-down, select Event.
From the On Click drop-down, enter or select dwfFilter.
Click Save Component.
Save your module.
Here's how the completed example looks in the Module Builder:
Preview your module in Express View and click Run DWF Filter. The Data Workflow filters for data using the memberOfEU="Yes"
argument. Data that matches the argument is sent to the filterTrue Hidden component. The data that does not match the argument is sent to the filterFalse Hidden component. The DevTools Console displays the following:
The Filter operator filters data based on a formula provided by the Creator. When the Data Workflow runs, the operator retrieves all matching data in the data set. For example, if an application asks an end-user a Yes
or No
question, the Filter operator can filter the data to only display Yes responses.
The Filter operator has two output ports. The upper output port outputs the data matching the criteria. The lower output port outputs data that does not match the criteria.
You can also connect an argument to the argument port of a Filter operator. Doing so lets you sort data based on a dynamic variable. For example, you might have a list of products in a Data Table component. The list of available products may depend on whether your client smokes or not. So, you can add a Dropdown component that offers Yes or No responses. With the Dropdown set as an argument, the operator filters based on the selection.
You’ll find the Filter operator under the Table group to the left of the Data Workflow canvas.
About the Info Window
Learn more about each setting in the Filter operator's Info window:
Setting | Description |
---|---|
Label | Sets the label for your operator, displaying below the 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 cleans values coming into or defined in the operator. For example, removing special characters. Some of those special characters include Sanitizing improves performance. But it can also lead to unexpected data behavior. If your Create Field is not 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 does not attempt to sanitize. |
Preserve Argument Type | When selected, this setting ensures the argument data type is respected when the operator executes. |
Expression | Here, you'll enter the criteria you want to filter your data by. The expression can be a single number, a string, an argument, or a full formula. For example, to find Yes data for the Do you smoke? expression, you'd use this formula: You can also add conditions to a formula. Conditioning your Expression filters your data using Let's say you're retrieving data for citizenship from different countries. You want to identify citizens from the United States of America and Mexico. By using AND, you'll only include those who have citizenship in all of the countries you list. To only accept dual citizens as an input, use this formula: |
Adding a Filter Operator
In this example, you'll create a Data Table component that contains a list of countries. You'll include a column displaying whether a country is part of the EU. Then, you'll set up a Data Workflow to separate countries that are part of the EU from those that are not.
Configure the Data Table Component
First, you'll set up your Data Table component with a list of countries, capitals, and whether they are part of the EU.
Drag and drop a Data Table component onto your canvas.
In the Property ID and Canvas Label Text fields, enter
dtCountries
.In the data table, enter the following:
#
A
B
C
1
country
capital
memberOfEU
2
Afghanistan
Kabul
No
3
Albania
Tirana
No
4
Algeria
Algiers
No
5
Cambodia
Phnom Penh
6
Czechia
Prague
7
Andorra
Andorra la Vella
No
8
Austria
Vienna
Yes
Click Save & Close.
Configure the Hidden Components
Before you can add your Data Workflow, add two Hidden components to store the Data Workflow results. Your filterTrue Hidden component contains countries that are part of the EU, and your filterFalse Hidden component contains countries that are not part of the EU.
Drag and drop two Hidden components onto your canvas, placing them below your dtCountries Data Table component.
In each component's Property ID and Label Text fields, enter the following:
#
Property ID
Label Text
1
filterTrue
filterTrue
2
filterFalse
filterFalse
Save & Close each component as you add it.
Configure the Data Workflow Component
Drag and drop a Data Workflow component onto your canvas, placing it above your Hidden components.
In the Canvas Label Text and Property Name fields, enter
dwfFilter
.
Configure the Input Data Operator
Drag and drop an Input operator onto your Data Workflow canvas.
Configure the operator's Info window as follows:
Setting
Value
Category
Input
Component
dtCountries
Required
Yes
Source
Default
Configure the Filter Operator
Drag and drop a Filter operator onto your Data Workflow canvas.
Configure the operator's Info window as follows:
Setting
Value
Category
Filter
Label
Filter Members of the EU
Do Not Sanitize Formula
Yes (checked)
Preserve Argument Type
Unchecked (no)
Expression
memberOfEU="Yes"
Connect the output port (right) of the dtCountries Input operator to the input port (left) of the Filter Members of the EU Filter operator.
Configure the First Output Operator
Drag and drop an Output operator onto your Data Workflow canvas.
Configure the operator's Info window as follows:
Setting
Value
Category
Output
Component
filterTrue
Action
value
Connect the upper output port (right) of the Filter Members of the EU Filter operator to the input port (left) of the filterTrue Output operator.
Configure the Second Output Operator
Drag and drop a second Output operator onto your Data Workflow canvas.
Configure the operator's Info window as follows:
Setting
Value
Category
Output
Component
filterFalse
Action
value
Connect the lower output port (right) of the Filter Members of the EU Filter operator to the input port (left) of the filterFalse Output operator.
Click Save.
Here's how the completed Data Workflow looks:
Configure the Button Component
Lastly, create a button that the end-user clicks in Express View to trigger your Data Workflow.
Drag and drop a Button component onto your canvas, placing it below the filterFalse Hidden component.
In the Property ID field, enter
btwRunDWF
.In the Label Text field, enter
Run DWF Filter
.Navigate to the Actions settings.
From the Action Type drop-down, select Event.
From the On Click drop-down, enter or select dwfFilter.
Click Save Component.
Save your module.
Here's how the completed example looks in the Module Builder:
Preview your module in Express View and click Run DWF Filter. The Data Workflow filters for data using the memberOfEU="Yes" argument. Data that matches the argument is sent to the filterTrue Hidden component. The data that does not match the argument is sent to the filterFalse Hidden component. The DevTools Console displays the following: