On Wednesday, August 10, 2011 02:34:01 am Vineet Deodhar wrote:
> #create stat bizobj
> statBizObj = dabo.biz.dAutoBizobj(conn)
> statBizObj.DataSource = 'stat'
> statBizObj.KeyField = 'statid'
> statBizObj.NonUpdateFields = ['statid']
> statBizObj.UserSQL = 'select * from stat'
> statBizObj.requery()
>  
> #create dist bizobj
> distBizObj = dabo.biz.dBizobj(conn)
> distBizObj.KeyField = 'distid'
> distBizObj.ParentLinkField = 'statid'
> distBizObj.NonUpdateFields = ['distid']
> distBizObj.UserSQL = 'select distid,distnm,statid,statnm from dist join
> stat using(statid)' distBizObj.addChild(statBizObj)
> distBizObj.requery()

The way I'd do it.

class PublicDistBizobj(dabo.biz.dBizobj):
     def afterInit(self):
        self.DataSource ='dist'
        self.KeyField = 'distid'
        self.addFrom('dist')
        self.addField('distnm')
        self.addField('statid')
        self.NonUpdateFields = ['distid']


class PublicStatBizobj(dabo.biz.dBizobj):
   def afterInit(self):
         self.DataSource = 'stat'
         self.KeyField = 'statid'
        self.addFrom('stat')
        self.addField('statnm')
        self.NonUpdateFields = ['statid']
        # I do not need to provide a UserSQL because the default is to retrieve 
all fields


statBizObj = PublicStatBiz(conn)
 distBizObj = PublicDistBizobj(conn)
 distBizObj.ParentLinkField = 'statid'
 disBizObj.LinkField = 'statid'
distBizObj..FillLinkFromParent = True
statBizObj.addChild(distBizObj)

statBizObj.requery()

>From your description 'dist' is a child of 'stat' (dist has the FK)

You might consider providing a 'Limit' statement.  Dabo's default 'Limit' is 
1000.  Using a class will allow Dabo to retrieve the data type along with the 
complete data structure.  

I think that will work.

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