cancel
Showing results for 
Search instead for 
Did you mean: 

Error in filter collection

KT
Level 4

Hi,

I am trying to filter my collection with a pattern like this. description Like %temp%access%

It seems to not work in Blue Prism. How should i do this?



------------------------------
K T
------------------------------
6 REPLIES 6

steven.boggs
Staff
Staff

What is the specific error message you're getting when you attempt this?

Are you using the 'Filter Collection' action within the "Utility – Collection Manipulation" Object?

Can you share an example of how you're trying to do this so others can provide recommendations?



------------------------------
Steve Boggs
Senior Product Support Engineer
Blue Prism
Austin, TX
------------------------------

Sure. Here is the error message

Internal : Could not execute code stage because exception thrown by code stage: Error in Like operator: the string pattern '%temp%access%' is invalid.

This is the action

13367.png



------------------------------
K T
------------------------------

Hello KT

Could you try;

"[description] like '%temp%' AND [description] like '%access%'"

description column must be in brackets

Regards



------------------------------
Daniel Sanhueza
RPA Professional Developer
Deloitte
America/Santiago
------------------------------

Daniel Sanhueza
RPA Professional Developer
Deloitte

Hello,
 
If necessary, here is auxiliary documentation with some other examples in addition to those already presented: Filter c# examples
 
Regards


------------------------------
Leonardo Soares
RPA Developer Tech Leader
América/Brazil
------------------------------
Leonardo Soares RPA Developer América/Brazil

Hi KT,

The LIKE operator allows a wildcard (% or *) at the beginning of the string, at the end, or both. For some reason, it doesn't allow a wildcard in the middle.

The workaround is what Daniel has already posted: break it into multiple LIKE operations. Technically, this doesn't give exactly the same results: 
No access to temp

matches the conditions [description] like '%temp%' and [description] like '%access%' even though it isn't like '%temp%access%'. If this is an important difference in your case, you may have to loop through the results and do a second check (using Regex or InStr).

Hope this helps.



------------------------------
Andrew Pascal
------------------------------

Hello KT. A far as my experience goes,  if there are more than one conditions, the expression needs to enclosed in parenthesis and also the "like" should be in upper case. So essentially it should look like 
([description] LIKE '%temp%') AND ([description] LIKE '%access%'))
 The order of and or conditions can be achieved by parenthesis. Could you try the above?




------------------------------
Susamay Halder Consultant
Consultant
Bruce Power
+1(437)217-1086
------------------------------