On Thu, Oct 29, 2009 at 5:18 AM, Ed Leafe <[email protected]> wrote:
> On Oct 27, 2009, at 10:36 PM, Aaron Carlow wrote:
>
> > I'm admittedly new at Python and programming in general but not
> > totally
> > without understanding. However, I'm am completely and utterly
> > frustrated
> > with how I'm supposed to handle the following situation:
> >
> > 1) A single form
> > 2) Multiple tabs (dPages)
> > 3) Each tab with it's own table and associated bizObj
> >
> > How in the world am I supposed to assign a bizObj to a dPage/dGrid?
> > I've
> > spent literally hours banging my head against the wall, searching this
> > newsgroup, reading the API docs, the tutorials, screencasts, etc.
> > What am I
> > missing?!
> >
> > I've tried to do the following in dForm.createBizobs():
> >
> > bizAddEvent = self.Application.biz.EventBizobj(conn,
> > DataSource="AddEvent")
> > self.addBizobj(bizAddEvent)
> > self.bizAddEventDS = bizAddEvent.DataSource
>
> You do not need that last line. The bizobj itself is the data
> source
> for your controls.
>
> > bizModifyEvent = self.Application.biz.EventBizobj(conn,
> > DataSource="ModifyEvent")
> > self.addBizobj(bizModifyEvent)
> > self.bizModifyEventDS = bizModifyEvent.DataSource
> >
> > bizModifyExhibitor = self.Application.biz.ExhibitorBizobj(conn,
> > DataSource="ModifyExhibitor")
> > self.addBizobj(bizModifyExhibitor)
> > self.bizModifyExhibitorDS = bizModifyExhibitor.DataSource
> >
> > The idea being that I would use the self.??????DS object in the
> > dGrid.DataSource property but I get no data. Am I even close to
> > doing this
> > the right way?
>
> Just set the DataSource for the controls (grid or anything else) to
> the same string as the bizobj's DataSource. E.g.:
>
> gridExhibitor.DataSource = "ModifyExhibitor"
>
> Also, I might be reading too much into your names, but it looks like
> you have different bizobjs for read and write operations. That is not
> necessary and probably a bad idea. If you explain a bit what you're
> trying to accomplish, we might be able to give you some guidance for
> designing your tables and bizobjs.
>
>
> -- Ed Leafe
>
> 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
--- 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]