On Thursday 29 October 2009 12:13:31 pm John wrote:
> On Thursday 29 October 2009 11:52:24 am Aaron Carlow wrote:
> > I think I get it now. For some reason I never made the connection that
> > bizObj.DataSource == TableName. I assumed that the table name was not
> > tied directly to the DataSource name. If I'm correct this means that you
> > cannot create more than one instance of a bizobj that uses the same table
> > because then the DataSource string/identifier is the same and the program
> > has no way of differentiating between the two, correct? What is the
> > recommended way of having two unconnected dPages that the use the same
> > table as the source?
> >
> > class EventBizobj(dabo.biz.dBizobj):
> > def afterInit(self):
> > self.DataSource = "Event"
> > self.KeyField = "EventID"
> > self.addFrom("Event")
> > self.addField("Event.EventName")
> > ...
> >
> > def createBizobjs(self):
> > conn = self.Application.getConnectionByName('ServerName-MySQL')
> >
> > bizEvent = self.Application.biz.EventBizobj(conn)
> > self.addBizobj(bizEvent)
> >
> > bizEventView = self.Application.biz.EventBizobj(conn)
> > self.addBizobj(bizEventView)
> >
> > With this code both bizobjs have the same DataSource since they are using
> > the same table and therefore the Dabo framework can't differentiate the
> > two. Could I do:
> >
> > bizEventView.DataSource="SomeArbitraryname"
> >
> > and have it accessible as a DataSource in a dGrid for instance using
> > "SomeArbitraryName" but in fact pulling data from the "Event" table?
> >
> > Really appreciate how helpful you guys are, especially to someone who is
> > such an obvious newbie.
> >
> > Aaron L. Carlow
>
> I have run into the issue myself several times. It could be that my
> history with VFP has influenced my believing I need the ability to re-use a
> table. I still believe it would be a very nice feature. But I have gotten
> around the issue too.
>
> You could use a database view for one of the tables. This works if you do
> not need to update the data. You could also use a filter on the database.
> I have not used this feature. I have also used something similar to a
> filter where I created a dabo dict using direct sql statements and handled
> all the update requirements.
>
> tempCur = self.PrimaryBizobj.getTempCursor
> tempCur.execute("select * from some_table where some_filter")
>
> Now do what you need to do with the data.
>
> Johnf
I forgot a trick I've used too,
I have used joins to setup read only data sources too.
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]