Thanks John & Paul.
### (excessive quoting is removed for readability)
I looked at the RowCount of distBizObj.
It is only 2.
There are total 31 records in the 'dist' table in MySQL DB.
Upon looking closely, I found that the only those 'dist' records are fetched
which have statid=1.
For your ready ref., my modified code is like this---
### code start ###
#connection object
ci = dabo.db.dConnectInfo(Host='localhost', DbType='MySQL', Database='whlbel',
User='root', PlainTextPassword='123')
conn = dabo.db.dConnection(ci)
class PublicDistBizobj(dabo.biz.dBizobj):
def afterInit(self):
self.DataSource ='dist'
self.KeyField = 'distid'
self.addFrom('dist')
self.addField('distid')
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('statid')
self.addField('statnm')
self.NonUpdateFields = ['statid']
statBizObj = PublicStatBizobj(conn)
distBizObj = PublicDistBizobj(conn)
distBizObj.LinkField = 'statid'
distBizObj.FillLinkFromParent = True
statBizObj.addChild(distBizObj)
statBizObj.requery()
distBizObj.requery()
### code end ###
At the interactive prompt, I tried this --
>> from dabovmd import bo # 'bo.py' is in 'dabovmd' folder
>> bo.distBizObj.RowCount
2
>> for rownum in bo.distBizObj.bizIterator():
... rec = bo.distBizObj.Record
... print rownum, rec.distid, rec.distnm, rec.statid
...
0 1 stat1 1
1 25 stat2 1
(actually there are 31 recored in the MySQL DB)
for table 'stat', the same procedure is working correctly.
Then, just for testing, I commented out the following statement--
#distBizObj.LinkField = 'statid'
And now I am getting all the 'stat' bizobj contents.
I can seek() and setFieldVal() and save() it.
I think some filter is causing this behaviour, when the 'LinkField' is
specified (only those rows with statid=1 are fetched from dist table).
Can you pl. suggest on the points below ---
1) whether it is OK to comment-out that line?
2) whether the PK of parent table would by default be taken as the FK in child
table? (as we have addChild method called).
3) Even if 1) & 2) are OK, there will be a situation in cases where the FK is
not the primary key of parent table ,but some other field in that table is FK
for child table.
What to do in such cases?
Thanks,
Vineet
--- 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]