Using arrays as filters?

Posts   
 
    
rboarman
User
Posts: 83
Joined: 01-Feb-2005
# Posted on: 09-Aug-2006 00:30:19   

Hello,

Is it possible to use an array of identity values (GUIDs in my case) as a filter for retrieving a collection from the database?

I’d like to do something like this:

ArrayList myIDs = new ArrayList();
myIDs.Add(“guid1”);
myIDs.Add(“guid2”);

MyCollection itemsToProcess = new MyCollection();
IPredicateExpression filter = new PredicateExpression(MessagesFields.RowGUID == myIDs);
itemsToProcess.GetMulti(filter);

The resulting query should look something like this:

Select *
From MyCollection
Where RowGUID in (‘guid1’, ‘guid2’)

Thank you in advance!!

Rick

bclubb
User
Posts: 934
Joined: 12-Feb-2004
# Posted on: 09-Aug-2006 03:33:41   

Check this section of the documentation. Generated code - The predicate system, Adapter - FieldCompareRangePredicate.

int[] values = new int[3] {1, 2, 5};
bucket.PredicateExpression.Add(OrderFields.OrderDate == values);