Filter a collection with multiple values .

manzur

New Member
Hi BluePrism Community,
I have a requirement where I need to read filter keys from configuration file and then filter the collection.Please suggest how can I achieve in blueprism.
 

gil.silva

Active Member
Hello manzur,

You can use the Filter Collection action with the syntax:
"[ColumnName] LIKE ' filter_value1' OR 'filter_value2' OR 'filter_value3'"
 

manzur

New Member
Hello manzur,

You can use the Filter Collection action with the syntax:
"[ColumnName] LIKE ' filter_value1' OR 'filter_value2' OR 'filter_value3'"


Hi gil,
Thank you for the solution but I need to filter a collection with multiple values at a time say I have Collection A (Column "Animal" Values=dog,goat,camel,tiger,lion)which I need to filter and Collection B(dog,goat) which has filtered values .So I need to filter Collection A using Collection B as filter criteria.
 

sunortap

Member
Hello - my BluePrism is dead today so please try this:

Create Data Items:
SQL Command (text)
FilterValues (text)
Comma position (number)

1. Multi Calc:
a) SQL Command = [Collection.Column] & " LIKE " 'beginning of SQL Command
b) FilterValues = [Collection.Values] 'will be used for calculation
c) Comma position = InStr([Collection.Values],",")'will be used for calculation

2. Decision stage:
Comma position = 0 ' if there is no more comma that means this is last value to filter

IF YES path
Multi Calc:
a) SQL Command = [SQL Command] & " OR " & Left([FilterValues], [Comma position] - 1) 'take string which is before commna (-1)
b) FilterValues = Mid(FilterValues,[Comma position] + 1, Len(FilterValues)) 'erase used value (+1 to skip comma)
c) Comma position = InStr([Collection.Values],",")'will be used for calculation
Go back to Decision Stage

IF NO path
Multi Calc:
1) SQL Command = [SQL Command] & " OR " & [FilterValues]
2) SQL Command = Replace( [SQL Command], "LIKE OR","LIKE" 'in sql command it will be LIKE OR which is incorrect so use replace to enter correct value

Filter Collection using SQL Command
 
Top