[dabo-users] Re : Reference biz objects from ui

Author: Dave Nation

Posted: 2007-02-28 at 13:43:09

Thanks for your speedy reply.

I have tried your suggestions and got the following exceptions :

File "C:\THS\orderbook\ui\PagEditProduct.py", line 45, in createItems

mybiz = self.getBizObject('product')

AttributeError: 'PagEditProduct' object has no attribute 'getBizObject'

File "C:\THS\orderbook\ui\PagEditProduct.py", line 45, in createItems

mybiz = self.Form.getBizObject('product')

AttributeError: 'FrmProduct' object has no attribute 'getBizObject'

My code in biz\Product.py is as follows :-

def getDepartments(self):

crs = self.getTempCursor()

crs.execute('select id, name from department order by name')

dset = crs.getDataSet()

names = [rec['name'] for rec in dset]

ids = [rec['id'] for rec in dset]

return (names,keys)

My code in ui\PagEditProduct is as follows :-

mybiz = self.Form.getBizObject('product')

objectRef = self.addObject(dabo.ui.dListBox, Caption="Department",

NameBase="DepartmentID", DataSource="Product",

DataField="DepartmentID", ValueMode='Key',

Choices = mybiz.getDepartments()[0],

Keys = mybiz.getDepartments()[1])

I am now also wondering, if I've started from the wrong place. I used

the AppWizard to generate the code as a base for my application, and am

now trying to modify the generated code to handle foreign keys etc.

Given your comments about the ClassDesigner not being able to 'edit'

classes generated by the AppWizard, I am wondering if I am really

starting from the wrong place.

Should I rather be building my classes from scratch.

Thanks once again for your help.

Dave

©2007 Dave Nation