Filter Operator

Prev Next

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 ', $, #, and &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 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: doYouSmoke="Yes". Matched data goes through the upper output port. Unmatched data goes through the lower output port.

You can also add conditions to a formula. Conditioning your Expression filters your data using AND or OR. AND returns data that's true for all criteria listed. OR checks if any one of the conditions you list is true.

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: =AND(citizen=‘Mexico’, citizen=‘USA’). By using OR, you'll filter citizens from either country in your list. To include citizens from either country as an input, use this formula: =OR(citizen=‘Mexico’, citizen=‘USA’).

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.

  1. In the Module Builder, drag and drop a Data Table component onto your canvas.

  2. In the Property ID field, enter dtCountries.

  3. 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

  4. 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.

  1. Drag and drop two Hidden components onto your canvas, placing them below the dtCountries Data Table component.

  2. In each component's Property ID and Label Text fields, enter the following:

    #

    Property ID

    Label Text

    1

    filterTrue

    filterTrue

    2

    filterFalse

    filterFalse

  3. After configuring each component, click Save Component.

Configure the Data Workflow Component

  1. Drag and drop a Data Workflow component onto your canvas, placing it between the dtCountries Data Table and Hidden components.

  2. In the Property ID and Canvas Label Text fields, enter dwfFilter.

Configure the Input Data Operator

  1. Drag and drop an Input operator onto your Data Workflow canvas.

  2. Configure the operator's Info window as follows:

    Info

    Category

    Input

    Component

    dtCountries

    Required

    Yes

    Source

    Default

Configure the Filter Operator

  1. Drag and drop a Filter operator onto your Data Workflow canvas.

  2. 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"

  3. 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

  1. Drag and drop an Output operator onto your Data Workflow canvas.

  2. Configure the operator's Info window as follows:

    Info

    Category

    Output

    Component

    filterTrue

    Action

    value

  3. 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

  1. Drag and drop a second Output operator onto your Data Workflow canvas.

  2. Configure the  operator's Info window as follows:

    Info

    Category

    Output

    Component

    filterFalse

    Action

    value

  3. 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.

  4. 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.

  1. Drag and drop a Button component onto your canvas, placing it below the filterFalse Hidden component.

  2. In the Property ID field, enter btwRunDWF.

  3. In the Label Text field, enter Run DWF Filter.

  4. Navigate to the Actions settings.

  5. From the Action Type drop-down, select Event.

  6. From the On Click drop-down, enter or select dwfFilter.

  7. Click Save Component.

  8. 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 ', $, #, and &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 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: doYouSmoke="Yes". Matched data goes through the upper output port. Unmatched data goes through the lower output port.

You can also add conditions to a formula. Conditioning your Expression filters your data using AND or OR. AND returns data that's true for all criteria listed. OR checks if any one of the conditions you list is true.

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: =AND(citizen=‘Mexico’, citizen=‘USA’). By using OR, you'll filter citizens from either country in your list. To include citizens from either country as an input, use this formula: =OR(citizen=‘Mexico’, citizen=‘USA’).

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.

  1. Drag and drop a Data Table component onto your canvas.

  2. In the Property ID and Canvas Label Text  fields, enter dtCountries.

  3. 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

  4. 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.

  1. Drag and drop two Hidden components onto your canvas, placing them below your dtCountries Data Table component.

  2. In each component's Property ID and Label Text fields, enter the following:

    #

    Property ID

    Label Text

    1

    filterTrue

    filterTrue

    2

    filterFalse

    filterFalse

  3. Save & Close each component as you add it.

Configure the Data Workflow Component

  1. Drag and drop a Data Workflow component onto your canvas, placing it above your Hidden components.

  2. In the Canvas Label Text and Property Name fields, enter dwfFilter.

Configure the Input Data Operator

  1. Drag and drop an Input operator onto your Data Workflow canvas.

  2. Configure the operator's Info window as follows:

    Setting

    Value

    Category

    Input

    Component

    dtCountries

    Required

    Yes

    Source

    Default

Configure the Filter Operator

  1. Drag and drop a Filter operator onto your Data Workflow canvas.

  2. 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"

  3. 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

  1. Drag and drop an Output operator onto your Data Workflow canvas.

  2. Configure the operator's Info window as follows:

    Setting

    Value

    Category

    Output

    Component

    filterTrue

    Action

    value

  3. 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

  1. Drag and drop a second Output operator onto your Data Workflow canvas.

  2. Configure the operator's Info window as follows:

    Setting

    Value

    Category

    Output

    Component

    filterFalse

    Action

    value

  3. 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.

  4. 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.

  1. Drag and drop a Button component onto your canvas, placing it below the filterFalse Hidden component.

  2. In the Property ID field, enter btwRunDWF.

  3. In the Label Text field, enter Run DWF Filter.

  4. Navigate to the Actions settings.

  5. From the Action Type drop-down, select Event.

  6. From the On Click drop-down, enter or select dwfFilter.

  7. Click Save Component.

  8. 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:

Resources