• Home
  • Filter a Collection

This action is used to filter specific rows in a collection based on a criterion. The resultant row(s) can be stored back in the same collection or in a new one

Filter a Collection

The Filter Collection action is found in the Utility – Collection Manipulation object. You will first need to import that business object – read “Objects created by Blue Prism” for more information.

As the name suggests, this action is used to filter specific rows in a collection based on a criterion. The resultant row(s) can be stored back in the same collection or in a new one.

Filter Action Properties Inputs

There are 2 inputs for this action:

  • Collection In – the collection that contains the rows that need to be filtered.
  • Filter – the criteria to determine which rows to keep. The structure of the filter follows SQL rules and must produce a true or false result.

Filter Action Properties Outputs

The only output is the name of the collection that will store the results.

1. Basic filter rules

  • • The whole criteria must be in double quotes.
  • • The name of a column from the collection must be in square brackets [] if the name contains a space. If there are no spaces, you can leave the brackets out.
  • • Text values must be in single quotes.
  • • The filter is not case sensitive.

Examples

  • • “[Dept] = ‘A’” can also be written as “Dept = ‘A’”
  • • “[Monthly Salary] >= 10000”
  • • “[Cost Price] > [Sale Price]”
  • • “[First Name] like ‘J%'” (finds all rows with a first name starting with J)
  • • “Dept = ‘A’ and Salary > 30000”

2. Filter using a data item

If you want to refer to a data item in your filter text you will need to use concatenation to get the desired result.

Example 1

Assuming [Cost Price Limit] is a number Data Item and [Cost Price] is a column in the collection.

If you create the filter as “[Cost Price] > [Cost Price Limit]”, Blue Prism will assume that [Cost Price Limit] is the name of a column and you will get an error.

You will need to create your filter like this - “[Cost Price] > “ & [Cost Price Limit].

Example 2

If you want to use a text Data Item you need to make sure you include the single quotes that would normally surround the text value.

Assuming [Dept Choice] is a text Data Item and [Dept] is a column in the collection.

The filter will need to be created as “[Dept] = ‘” & [Dept Choice] & “'”