cancel
Showing results for 
Search instead for 
Did you mean: 

Collection Manipulation - Filter Collection

JordanGreen
Level 3
Just a quick question to anyone who has used the Filter Collection object, which is part of the standard Collection Manipulation Utility.   How does the syntax for the filter Input work. I have tried to just send variable, as the aim is to get all rows that contain this variable into a separate collection without tampering with the original collection and filtering seemed like an good solution, but without knowing how I filter, it's a bit of a non-starter.   Any help very much appreciated.   Thanks, Jordan Green
12 REPLIES 12

John__Carter
Staff
Staff
Try something like ""FieldWithoutSpaces > 0 AND [Field With Spaces] = 'abc'

JordanGreen
Level 3
I tried using that syntax, which now means the object doesn't fail. However, it looks like now it just filters whole collections, rather than extracting the fields with the information that matches the filter.   Seems that the object filters whole collections rather than the fields within them.

John__Carter
Staff
Staff
The Filter action is intended to return all rows matching the criteria. Your requirement seems to be one step more - to filter out unwanted rows and unwanted columns. The current collection utility doesn't have that functionality, but I think you can achieve what you want with another couple of lines of code. Something like this: 'Get filtered rows Collection_In.DefaultView.RowFilter = Filter Collection_Out = Collection_In.DefaultView.ToTable() 'Select columns Dim v As New DataView(Collection_Out) Collection_Out = v.ToTable(False, Column_Names_CSV.Split("",""))

John__Carter
Staff
Staff
'Get filtered rows Collection_In.DefaultView.RowFilter = Filter Collection_Out = Collection_In.DefaultView.ToTable() 'Select columns Dim v As New DataView(Collection_Out) Collection_Out = v.ToTable(False, Column_Names_CSV.Split("",""))  

John__Carter
Staff
Staff
Sorry - trying to post with line breaks!

RekhaMurari
Level 2
I want to match anything that starts with abc , how do I use the expression. Like how we use wildcards ""abc""&""-##

VenkatRamana
Level 3
use it - ""FieldName like abc*

VenkatRamana
Level 3
VBO - collection manipulation Action - Filter collection

HarjyotMalik
Level 2
If we are checking for a specific fund we can use the below expression in the Filter Collection field. ""fund=' "" & ""ABC"" & "" ' ""   Does anyone knows how I can use OR in the above Filter to include Fund = ""XYZ"" as well?