On Wednesday 27 January 2010 05:25:06 am Ed Leafe wrote:
> On Jan 27, 2010, at 1:18 AM, Mike wrote:
> > I need to change the Datasource property because I have form with two
> > grids which show different parts of the same table and so they cant both
> > have the same datasource
>
> For a bizobj, 'DataSource' is the name of the underlying table it
> represents. If you change it, the queries will now try to pull data from
> that new name, which is probably not what you want. The 'DataSource' is not
> an arbitrary name; it indicates the 'source' of the 'data' for the bizobj.
>
> If you need multiple bizobjs for the same table, you'll have to do a
> little coding. First, in the form's createBizobjs() method, you'll need to
> store references to these bizobjs. Let's say the table is 'foo', and you
> want to create two bizobjs for this
>
> def createBizobjs(self):
> conn = self.Application.getConnectionByName("Foo")
> self.foo1 = self.Application.biz.FooBizobj(conn)
> self.addBizobj(self.foo1)
> self.foo2 = self.Application.biz.FooBizobj(conn)
> self.addBizobj(self.foo2)
>
>
> Now you have two instances of the bizobj stored as attributes of the
> form.
> Next, you'll have to override the form's getBizobj() method:
>
> def getBizobj(self, dataSource=None, parentBizobj=None):
> if dataSource == 'foo1':
> return self.foo1
> elif dataSource == 'foo2':
> return self.foo2
> else:
> return super(ThisFormClass, self).getBizobj(
> dataSource=dataSource, parentBizobj=parentBizobj)
>
> Now you can set the DataSource property of your controls to either
> 'foo1'
> or 'foo2', and they will be bound the the correct bizobj.
>
>
> -- Ed Leafe
If memory serves Larry and I attempted very similar code without success.
However, in our code we wanted different relationships for the same table and
this was over a year ago. There have been changes to Dabo. We ended up
using a view because everything we tried did not work. I don't recall where
we failed but it should be in list history somewhere. I think it had to do
with Dabo using the real table name deep in the code.
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]