@John,
I tried with the class-based code as you have shown.
 
seek() & setFieldVal() are working for 'statBizObj' only.
But it is not working for 'distBizObj'.
'Not Working' means, no value is fetched from the 'distBizObj' through seek(), 
although it is there in the database.
 
I could observe it through --
 
>> for rownum in distBizObj.bizIterator():
>> ...     rec = distBizObj.Record
>> ...     print rownum, rec.distid, rec.distnm, rec.statid
 
No result is printed.
 
When tested on statBizObj the same way, result is fetched.
I don't understand what's wrong with distBizObj.
-------------------------

@Thomas,
I have made sure that there is a matching record in the second bizobj.
-------------------------
 
Any idea what may be wrong in this issue?
---Vineet
 
From: John Fabiani <[email protected]>
To: Vineet Deodhar <[email protected]>; Dabo Users list <[email protected]>
Sent: Wednesday, 10 August 2011, 19:19
Subject: Re: [dabo-users] standalone BizObj with FK relation not saving into 
database

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

--- StripMime Report -- processed MIME parts ---
multipart/alternative
  text/plain (text body -- kept)
  text/html
---
_______________________________________________
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