Print Page | Close Window

Filtering children rows

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce Classic
Forum Discription: For .NET 2.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=501
Printed Date: 13-Oct-2025 at 8:29pm


Topic: Filtering children rows
Posted By: lars-erik
Subject: Filtering children rows
Date Posted: 15-Oct-2007 at 1:34pm

I have Order and Orderdetail in a one-to-many relation.

I want to filter the Orderdetail meeting a special criteria.
Is this possible? (without making my own entityList of Orderdetail)
E.g. Is it possible to have parameters in the SqlWhere in the entity of Orderdetail?



Replies:
Posted By: eileenv
Date Posted: 18-Oct-2007 at 5:14pm

There are some drawbacks to using the SqlWhere clause for filtering:

·         DevForce does not validate “Sql Where” clause text; if it is not valid for the runtime database, DevForce will pass the database exception back to the caller.
 
·         The clause applies only for database OQL queries when they resolve into SQL queries applied to the database table. The clause is ignored when the OQL generates a query against the entity cache and it plays no role in any other kind of entity query such as a PassThru SQL or Stored Procedure Query.
 
·         The clause can only be used to differentiate immutable objects. In other words, if a change occurs such that an OrderDetail should belong to this filtered list, the OrderDetail will not become part of the list immediately; first you must save it, remove it from the cache, then re-fetch the OrderDetail object.
 
To filter instances dynamically, you might consider using an EntityListManager as described in the following tech tip:
http://www.ideablade.com/techtip_EntityListManager.htm - http://www.ideablade.com/techtip_EntityListManager.htm
 
 



Print Page | Close Window