How To: Use the Unique Operator's Argument Port to Dynamically Find Unique Values

Prev Next

This guide demonstrates how to use the Unique operator’s argument port to dynamically find unique values. The Unique operator selects unique values in a Data Workflow component’s data set. Creators can configure the operator’s argument port to find unique values using a Radio Button component.

Configuration

For this example, the fictional company “Petz Unlimited” wants to identify if they have one or more unique pet types and pet breeds in their inventory.  As a Creator assigned to this task, configure a Data Table component containing a list of the company’s pet inventory. Then configure a Data Workflow component using the Unique operator’s argument port to identify unique values in the dataset.

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

Configure the Data Table Component

First, set up a Data Table component containing the company’s current inventory of pets and their breeds.

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

  2. In the Property ID field, enter dtPets.

  3. In the data table, enter the following:

    #

    A

    B

    1

    Type

    Breed

    2

    dog

    Golden Retriever

    3

    dog

    Maltoise

    4

    dog

    Golden Retriever

    5

    dog

    Golden Retriever

    6

    cat

    Persian

    7

    dog

    Lab

    8

    dog

    Lab

    9

    dog

    Lab

    10

    cat

    Persian

    11

    bird

    Macaw

    12

    dog

    Pug

    Data table listing various pet types and their corresponding breeds for easy reference.

  4. Click Save Component.

Configure the Radio Buttons Component

Next, configure a Radio Buttons component to select which keys to use when finding unique values. Later, you'll set this as the argument for your Unique operator in the Data Workflow component.

  1. Drag and drop a Radio Buttons component onto your canvas, placing it below the dtPets Data Table component.

  2. In the Property ID field, enter findUnique.

  3. In the Label Text field, enter Find Unique.

  4. Navigate to the Data settings.

  5. In the Values table, enter the following:

    #

    Option Label

    Value to Store in Submission Data

    1

    Pet

    type

    2

    Breed

    breed

    3

    Pet and Breed

    type,breed

    Radio button options for pet type and breed selection in a data storage form.

  6. Navigate to the Validation settings.

  7. Set the Required toggle to A toggle switch icon indicating an on state for user interface settings. (ON). Enabling this setting means the end-user must enter a value into the field before navigating ahead.

  8. Click Save Component.

Configure the Hidden Component

Configure a Hidden component to receive a Data Workflow component’s output.

  1. Drag and drop a Hidden component onto your canvas, placing it below the findUnique Radio Buttons component.

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

  3. Click Save Component.

Configure the Data Workflow Component

Next, configure the Data Workflow component. You'll use one Input operator to bring in the dtPets table data. Then, configure a second Input operator to reference the findUnique Radio Button component’s table data. This second Input operator serves as the argument for the Unique operator. The Unique operator separates the dtPets data that holds unique values in argument keys. Then, the Data Workflow sends that data to the uniqueOutput Hidden component using an Output operator. Finally, configure Console operators to view the operator’s changes.

  1. Drag and drop a Data Workflow component onto your canvas, placing it below your findUnique Radio Buttons component.

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

Configure the First Input Operator

The first Input operator references your data table.

  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

    dtPets

    Required

    Yes

    Source

    Default

Configure the Second Input Operator

The second Input operator in this configuration references the selection made using your Radio Buttons component.

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

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

    Setting

    Value

    Category

    Input

    Component

    findUnique

    Required

    Yes

    Source

    Default

Configure the Unique Operator

Configure the Unique operator to ingest the dtPets Input operator’s data, and connect the findUnique Input operator’s data to serve as the argument.

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

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

    Setting

    Value

    Category

    Unique

    Label

    Show Unique _arg Value

    Unique Keys

    _arg

  3. Connect the output port (right) of the dtPets Input operator to the input port (left) of the Show Unique _arg Value Unique operator.

  4. Connect the output port (right) of the findUnique Input operator to the argument port (top) of the Show Unique _arg Value Unique operator.

Configure the Output Operator

The Output operator passes the result of your Data Workflow component to your uniqueOutput Hidden component.

  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

    uniqueOutput

    Action

    value

  3. Connect the output port (right) of the Show Unique _arg Value Unique operator to the input port (left) of the uniqueOutput Output operator.

Configure the First Console Operator

Configure the first Console operator to display the initial data set from the dtPets Data Table component.

  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

    beforeUnique

  3. Connect the output port (right) of the Show Unique _arg Value Unique operator to the input port (left) of the uniqueOutput Console operator.

Configure the Second Console Operator

Configure the second Console operator to display the results of the Unique operator. For this example, refer to this operator in the DevTools Console to confirm the Unique Operator is properly configured.

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

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

    Setting

    Value

    Category

    Console

    Label

    uniqueValues

  3. Connect the output port (right) of the Show Unique _arg Value Unique operator to the input port (left) of the uniqueOutput Console operator.

  4. Click Save Component.

Here’s how the completed Data Workflow component looks:

Workflow diagram illustrating data processing steps including inputs, outputs, and unique values.

Configure the Button Component

Use a Button component to trigger the dwfUnique Data Workflow component.

  1. Drag and drop a Button component onto your canvas, placing it below the dwfUnique Data Workflow Component.

  2. In the Property ID field, enter btnfindUnique.

  3. In the Label Text field, enter Find Unique Value.

  4. Navigate to the Actions settings.

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

  6. In the On Click field, enter dwfUnique.

  7. Click Save Component.

  8. Save your module.

The completed module looks like the following:

User interface displaying unique operator settings for pet data processing.

Preview your module in Express View and open the DevTools Console. From the Find Unique radio buttons, select Pet and Breed, then click Find Unique Value. In the DevTools Console, the uniqueValues Console operator displays the first unique breed for each pet type.

Console output showing unique pet types and breeds in a web application.

This guide demonstrates how to use the Unique operator’s argument port to dynamically find unique values. The Unique operator selects unique values in a Data Workflow component’s data set. Creators can configure the operator’s argument port to find unique values using a Radio Button component.

Configuration

For this example, the fictional company “Petz Unlimited” wants to identify if they have one or more unique pet types and pet breeds in their inventory.  As a Creator assigned to this task, configure a Data Table component containing a list of the company’s pet inventory. Then configure a Data Workflow component using the Unique operator’s argument port to identify unique values in the dataset.

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

Configure the Data Table Component

First, set up a Data Table component containing the company’s current inventory of pets and their breeds.

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

  2. In the Property ID field, enter dtPets.

  3. In the Canvas Label Text field, enter dtPets.

  4. Navigate to the Data settings.

  5. In the data table, enter the following:

    #

    A

    B

    1

    Type

    Breed

    2

    dog

    Golden Retriever

    3

    dog

    Maltoise

    4

    dog

    Golden Retriever

    5

    dog

    Golden Retriever

    6

    cat

    Persian

    7

    dog

    Lab

    8

    dog

    Lab

    9

    dog

    Lab

    10

    cat

    Persian

    11

    bird

    Macaw

    12

    dog

    Pug

    Data table displaying pet types and breeds, including dogs and cats.

  6. Click Save & Close.

Configure the Radio Buttons Component

Next, configure a Radio Buttons component to select which keys to use when finding unique values. Later, you'll set this as the argument for your Unique operator in the Data Workflow component.

  1. Drag and drop a Radio Buttons component onto your canvas, placing it below the dtPets Data Table component.

  2. In the Property ID field, enter findUnique.

  3. In the Label Text field, enter Find Unique.

  4. Navigate to the Data settings.

  5. In the Values table, enter the following:

    #

    Option Label

    Value to Store in Submission Data

    1

    Pet

    type

    2

    Breed

    breed

    3

    Pet and Breed

    type,breed

    Data source type options for radio button selection in a form interface.

  6. Navigate to the Validation settings.

  7. Set the Required toggle to A toggle switch icon indicating an on state for user interface settings. (ON). Enabling this setting means the end-user must enter a value into the field before navigating ahead.

  8. Click Save & Close..

Configure the Hidden Component

Configure a Hidden component to receive a Data Workflow component’s output.

  1. Drag and drop a Hidden component onto your canvas, placing it below the findUnique Radio Buttons component.

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

  3. Click Save & Close.

Configure the Data Workflow Component

Next, configure the Data Workflow component. You'll use one Input operator to bring in the dtPets table data. Then, configure a second Input operator to reference the findUnique Radio Button component’s table data. This second Input operator serves as the argument for the Unique operator. The Unique operator separates the dtPets data that holds unique values in argument keys. Then, the Data Workflow sends that data to the uniqueOutput Hidden component using an Output operator. Finally, configure Console operators to view the operator’s changes.

  1. Drag and drop a Data Workflow component onto your canvas, placing it below your findUnique Radio Buttons component.

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

Configure the First Input Operator

The first Input operator references your data table.

  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

    dtPets

    Required

    Yes

    Source

    Default

Configure the Second Input Operator

The second Input operator in this configuration references the selection made using your Radio Buttons component.

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

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

    Setting

    Value

    Category

    Input

    Component

    findUnique

    Required

    Yes

    Source

    Default

Configure the Unique Operator

Configure the Unique operator to ingest the dtPets Input operator’s data, and connect the findUnique Input operator’s data to serve as the argument.

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

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

    Setting

    Value

    Category

    Unique

    Label

    Show Unique _arg Value

    Unique Keys

    _arg

  3. Connect the output port (right) of the dtPets Input operator to the input port (left) of the Show Unique _arg Value Unique operator.

  4. Connect the output port (right) of the findUnique Input operator to the argument port (top) of the Show Unique _arg Value Unique operator.

Configure the Output Operator

The Output operator passes the result of your Data Workflow component to your uniqueOutput Hidden component.

  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

    uniqueOutput

    Action

    value

  3. Connect the output port (right) of the Show Unique _arg Value Unique operator to the input port (left) of the uniqueOutput Output operator.

Configure the First Console Operator

Configure the first Console operator to display the initial data set from the dtPets Data Table component.

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

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

    Setting

    Value

    Category

    Console

    Label

    beforeUnique

  3. Connect the output port (right) of the Show Unique _arg Value Unique operator to the input port (left) of the beforeUnique Console operator.

Configure the Second Console Operator

Configure the second Console operator to display the results of the Unique operator. For this example, refer to this operator in the DevTools Console to confirm the Unique Operator is properly configured.

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

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

    Setting

    Value

    Category

    Console

    Label

    uniqueValues

  3. Connect the output port (right) of the Show Unique _arg Value Unique operator to the input port (left) of the uniqueValues Console operator.

  4. Click Save.

Here’s how the completed Data Workflow component looks:

Data workflow diagram showing input, console, unique, and output components.

Configure the Button Component

Use a Button component to trigger the dwfUnique Data Workflow component.

  1. Drag and drop a Button component onto your canvas, placing it below the dwfUnique Data Workflow Component.

  2. In the Property ID field, enter btnfindUnique.

  3. In the Label Text field, enter Find Unique Value.

  4. Navigate to the Actions settings.

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

  6. In the On Click field, enter dwfUnique.

  7. Click Save & Close.

  8. Save your module.

The completed module looks like the following:

User interface displaying options for finding unique pet values in a data component.

Preview your module in Express View and open the DevTools Console. From the Find Unique radio buttons, select Pet and Breed, then click Find Unique Value. In the DevTools Console, the uniqueValues Console operator displays the first unique breed for each pet type.

Console output showing unique pet types and breeds in a web application.