On Monday, October 11, 2010 07:44:00 pm Bronwyn Woods wrote:
> I've recently realized the advantages of doing ad hoc queries using the
> getTempCursor method.  This is working very well for simple things, but I'm
> wondering if it's possible to do something similar to get at child Bizobjs.
> 
> For example, my form has a "Sections" Bizobj.  "Sections" has a child
> "bizDance".  I want to get the dance IDs linked to a given section ID.  My
> current function is as follows.  How could I rewrite this so that I don't
> wipe out the currently selected dataset for the Sections Bizobj?
> 
> biz = self.getBizobj("Sections")
> biz.UserSQL = "select * from Sections where ID=%s" %key
> biz.requery()
> biz2 = biz.bizDance
> ks = []
> for rownum in biz2.bizIterator():
> ks.append(biz2.Record.danceID)
> return(ks)
> 
> Thanks,
> Bronwyn

Anything that can be done in a SQL statement can be done from a temp cursor.  
myTempCursor = biz.getTempCursor()

myTempCursor.execute("Any sql statement and pass paramenters where ID = %s" %  
(key,))

When I say any SQL statemnet I mean the joins, subselects, etc. are all 
available.  So if you can do in SQL in can be done in a Dabo cursor.  

That's the PRO.  But you lose all the nice features like writing data back.  

It looks like you want to use a join or a simple subselect.

("select bizdance.danceID from sections join bizDance child on sections.id = 
bizdance.id where  ID = %s" % key)

Johnf



_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: 
http://leafe.com/archives/byMID/[email protected]

Reply via email to