nested subquery with FieldCompareSetPredicate

Posts   
 
    
Puromtec
User
Posts: 76
Joined: 22-Jun-2005
# Posted on: 22-Aug-2006 15:54:12   

I have 4 tables in this situation.

Parent->child->grandchild->great-grandchild

I have a TypedList of the Parent. I would like to create a filter for the Parent that will yield a list of Parents that contain a corresponding great-grandchild.

After using and reviewing FieldCompareSetPredicate, I've realised that it alone will not get me the proper result, because it looks at only one other table for "in" or "exists"

I, in fact, need this ability:

select * from "ParentTypedList" p where p.Pid in (select pid in child c where c.cid in (select cid from grandchild gc where gc.gcid in (select gcid from great-grandchild ggc) ) )

I KNOW that I COULD retrieve using other means, however, I'd like to filter on my TypedList for the parent.

Is there some way to "nest" the compareset predicate class objects?

Thanks, Darren

Jessynoo avatar
Jessynoo
Support Team
Posts: 296
Joined: 19-Aug-2004
# Posted on: 22-Aug-2006 16:46:59   

Hi,

I think you should find your way playing with relations/inner joins:

You may have a look in the user manual at:

using the Generated Code > Selfservicing / Adapter > Filtring and Sorting > Advanced Filter usage

You'll see how to add relations to your typedlist. by using inner join (default) with your relation, that should be equivalent nested exist conditions.

But now, still, you should be able to nest compareset predicates by providing inner predicates in the predicate constructors

Puromtec
User
Posts: 76
Joined: 22-Jun-2005
# Posted on: 22-Aug-2006 16:53:25   

Thanks, I don't know why I didn't think of that simple_smile