[Zope] Help: Recursive querying

Tom Schwaller Tom.Schwaller@linux-magazin.de
Thu, 12 Aug 1999 20:05:12 -0100


> Rob Page wrote:
> 
> > Try:
> > 
> > SQL Method  sqlSelectChildren:
> > ---
> >     select * from posts
> >     where
> >     <!--#if "parent_id == 0"-->
> >       parent_id is NULL
> >     <!--#else-->
> >       parent_id = <!--#sqlvar parent_id type=int-->
> >     <!--#/if-->
> > ---
> > 
> > Now the tree. This DTML gives a tree, with each node in the tree a
> > link to URL1/main_view?obj_id=<the object's id>
> > 
> > ---
> >     <!--#with "_.namespace(parent_id = 0)"-->
> >       <!--#tree id=parent_id
> > branches_expr="sqlSelectChildren(parent_id=parent_id)"-->
> >         <a href="<!--#var URL1-->/ViewPost?parent_id=<!--#var
> > parent_id-->">
> >              <!--#var title-->
> >         </a>
> >       <!--#/tree-->
> >     <!--#/with-->
> 


There seems to be no answer to this question available yet (??), 
although I'd like to find a solution (the above "solution" does
not work..)

Maybe someone can give us a simpler example for building a tree
with a database method (hope this is not a FAQ)? I remember having 
seen something here a long time ago, but finding the right keywords 
for a search in a Zope mail folder with over 9000 mails is not that easy
;-)

-- 

Tom 
http://www.linux-magazin.de/