UiPath Activities

The UiPath Activities Guide

Build and Filter DataTable

The example below explains how to filter and extract data from a DataTable by using Build Data Table, Filter Data Table, Output Data Table, For Each Row, and Get Row Item activities. You can find these activities in the UiPath.System.Activities package.

This is how the automation process can be built:

  1. Open Studio and create a new Process.
  2. Drag a Sequence container in the Workflow Designer.
    • Create the following variables:
Variable Name
Variable Type
Default Value

DT1

DataTable

-

DT2

DataTable

-

DataTableString

String

-

  1. Drag a Build Data Table activity inside the Sequence container.
    • In the Properties panel, add the variable DT1 in the DataTable field.
    • Click the DataTable button. The Build Data Table window contains a table with two columns and rows.
    • Click the Add Column button and add a new column.
    • Click the Edit Column button from the first column and add the value Name in the ColumnName field.
    • Select the String option from the Data Type drop-down list.
    • Select the check box for the Allow Null option.
    • Add the value -1 in the Max Length field.
    • Click the OK option for closing the window.
    • Click the Edit Column button from the second column and add the value Surname in the ColumnName field.
    • Select the String option from the Data Type drop-down list.
    • Select the check box for the Allow Null option.
    • Add the value -1 in the Max Length field.
    • Click the OK option for closing the window.
    • Click the Edit Column button from the third column and add the value Grade in the ColumnName field.
    • Select the Int32 option from the Data Type drop-down list.
    • Select the check box for the Allow Null option.
    • Add the value -1 in the Max Length field.
    • Click the OK button for closing the window.
    • Click the OK button again.
    • This is how the DataTable window should look:
  1. Drag a Filter Data Table activity below the Build Data Table activity.
  2. Click the Filter Wizard button.
    • Add the variable DT1 in the Input DataTable field.
    • Add the variable DT2 in the Output DataTable field.
    • Select the Keep option for the Rows Filtering Mode field.
    • Add the value "Grade" in the Column field.
    • Select the < value from the Operation drop-down list.
    • Add the value 5 in the Value field.
    • Click the Output Columns tab.
    • Select the Keep option for the Columns Selection Mode field.
    • Add the columns "Name" and "Surname".
    • Click the OK button.
    • This is how the Filter Wizard should look:
  1. Place an Output Data Table activity below the Filter Data Table activity.
    • In the Properties panel, add the variable DT2 in the DataTable field.
    • Add the variable DataTableString in the Text field.
  2. Drag a Write Line activity below the Output Data Table activity.
    • Add the variable DataTableString in the Text field.
  3. Place a For Each Row activity below the Write Line activity.
    • Add the variable DT1 in the DataTable field.
  4. Select the Body container and create the following variable:
Variable Name
Variable Type
Default Value

Grade

Int32

-

  1. Add a Get Row Item activity and place it inside the Body container.
    • In the Properties panel, add the value "Grade" in the ColumnName field.
    • Add the value row in the Row field.
    • Add the variable Grade in the Value field.
  2. Place an If activity below the Get Row Item activity.
    • Add the expression Grade < 5 in the Condition field.
  3. Drag a Write Line activity inside the Then field.
    • Add the expression "Failed:" + row("Name").ToString + " " + row("Surname").ToString in the Text field.
  4. Run the process. The robot extracts all data meeting the requirements.
    This is how your workflow should look:

Updated about a month ago


Build and Filter DataTable


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.