Does entity returned by GetMulti carry filter information?

Posts   
 
    
johnsmith
User
Posts: 19
Joined: 14-Dec-2004
# Posted on: 18-Dec-2007 14:52:20   

Hi all,

If I myParentCollection.GetMuti() having added a relation to and a filter on ChildEntity then myParentCollection[0].Child returns all ChildEntity for the first ParentEntity, not just the children subject to the original query filter. Does myParentCollection allow access to the filtered children collection at all?

Many thanks, JS.

gabrielk avatar
gabrielk
User
Posts: 231
Joined: 01-Feb-2005
# Posted on: 18-Dec-2007 19:01:11   

Hi,

I don't think it does. But you could get that information by doing a retrieval on the ChildEntity table and filtering on the ParentEntity using a RelationCollection (joins).

For example if you wanted all products sold to Customer A in Period X till Y you could retrieve all OrderDetailEntities based on a filter on the Orders (Order.Customer == A && Order.Date > X && Order.Date < Y).

Would this be a solution?

Cheers, Gab

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 19-Dec-2007 08:01:23   

If you want to fetch a collection of Customers filtered by some fields in the related Orders. And also you want to fetch each customer related orders filtered by the same filter, then you should use a prefetchPath to fetch the related Orders while fetching the Customers, and you should also pass a filter to that prefetchPath to limit the fetched Orders.