Filtering a collection
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
06-11-19 03:04 PM
Hi,
I am having some issues with filtering a collection.
Situation:
I have a collection that contains a column "Status". I need to filter this collection on that column but not on a single value. I need to filter this column on more than one values, for example "Planned", "In Process", "New", ...
I can filter on a single value, but I cannot figure out the syntax for multiple values.. Pretty lame not?
I am using the "Utility - Collection Manipulation" Business Object and the "Filter Collection" Action. In the "Filter" input I am using following expression:
"Status LIKE 'Planned'"
This one works, but how do I manage to add the other values? Expressions like these won't work..
"Status LIKE 'Planned' OR 'In Process' OR 'New'"
"Status LIKE 'Planned'" OR "Status LIKE 'In Process'" OR "Status LIKE 'New'"
If somebody could help me out with this simple thing, that would be great!
------------------------------
Geoffrey Adam
------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
07-11-19 05:37 AM
You also don't need to use LIKE if you are not using wildcards
Try this:
"[Status]='Planned' or [Status]='In Process' or [Status]='New'"
------------------------------
Pratyush Garikapati
ROM Architect
Blue Prism
Asia/Kolkata
------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
07-11-19 10:49 AM
As Pratyush said the problem seems to be related to syntxax. If the value you are searching on the Status column changes dynamically, than you should use a variable. If you will always filter the same status (Like Planned, In Process and New) than you can try:
Option 1: "Status IN ('Planned','In Process','New')"
Option 2: "Status LIKE 'Planned' OR Status LIKE 'In Process' OR Status LIKE 'New'"
If you want to have a deeper understandind how this action works you can take a look in the pages below
https://docs.microsoft.com/pt-br/dotnet/api/system.data.datatable.select?view=netframework-4.8
https://www.csharp-examples.net/dataview-rowfilter/
Cheers
------------------------------
Diogo Furlan
Analyst
Grupo NC
America/Sao_Paulo
------------------------------
