|
View:
New views
13 Messages
—
Rating Filter:
Alert me
|
|
|
How to use BizObjsI'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 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? Any guidance would be greatly appreciated and many thanks in advance! Aaron L. Carlow --- StripMime Report -- processed MIME parts --- multipart/alternative text/plain (text body -- kept) text/html --- _______________________________________________ Post Messages to: Dabo-users@... 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/394973d50910271936s423b6faew90276872dd300b76@... |
|
|
Re: How to use BizObjsOn 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 _______________________________________________ Post Messages to: Dabo-users@... 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/F5437126-8B1B-43A3-8F15-A3C6CBE9820C@... |
|
|
Re: How to use BizObjsOn Thursday 29 October 2009 05:18:12 am Ed Leafe 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 In addition to what Ed said make sure somewhere in your code you requery the database. Requery will retrieve the data - it's a simple bit of code often missed by newbies. This is normally done in the Form.afterInit() but can be done from other methods. def afterInit(self): self.requery() If you are using ClassDesigner make sure your grid control's 'DataSource' contains a value such as "AddEvent" (I think that's the name of one of the tables) and that you add a database field value for each of the grids columns 'DataField'. The Dabo framework will fill the grid with data. Of course the same is true if you hand code your forms. Don't get to frustrated ask questions here. We'll help. Johnf _______________________________________________ Post Messages to: Dabo-users@... 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/200910290707.20048.jfabiani@... |
|
|
Re: How to use BizObjsOn Thursday 29 October 2009 07:07:19 am John wrote:
> and that you add a database field value for each of the grids > columns 'DataField'. Sorry I should have said database field "name" - not the value in the database field. Johnf _______________________________________________ Post Messages to: Dabo-users@... 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/200910290712.02959.jfabiani@... |
|
|
Re: How to use BizObjsOn Thu, Oct 29, 2009 at 5:18 AM, Ed Leafe <ed@...> 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 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: Dabo-users@... 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/394973d50910291152h4dd2a813v8f3605f9c6e6cb34@... |
|
|
Re: How to use BizObjsOn Thu, Oct 29, 2009 at 7:07 AM, John <jfabiani@...> wrote:
> > If you are using ClassDesigner make sure your grid control's 'DataSource' > contains a value such as "AddEvent" (I think that's the name of one of the > tables) and that you add a database field value for each of the grids > columns 'DataField'. The Dabo framework will fill the grid with data. Of > course the same is true if you hand code your forms. > > John, thanks for your help! One question I have about setting a dGrid control's DataSource - when using ClassDesigner, is it better to assign the DataSource within the Object Properties (thereby putting it into the XML definition of the control) or by using the control's initProperties() method? It may just be my system but ClassDesigner seems a bit "quirky" in some of the Object Properties fields in that sometimes I get a boolean checkbox instead of what should be a string value and this has me thinking perhaps it is better to put that in the initProperties() method instead. Aaron L. Carlow --- StripMime Report -- processed MIME parts --- multipart/alternative text/plain (text body -- kept) text/html --- _______________________________________________ Post Messages to: Dabo-users@... 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/394973d50910291200qc561bc5ga2600ddb77611e75@... |
|
|
Re: How to use BizObjsOn 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 _______________________________________________ Post Messages to: Dabo-users@... 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/200910291213.31462.jfabiani@... |
|
|
Re: How to use BizObjsOn 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: Dabo-users@... 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/200910291218.01000.jfabiani@... |
|
|
Re: How to use BizObjs----- "Aaron Carlow" <acarlow@...> 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 may be missing something but why do you need to create two instances of the same bizobj? The self.addBizobj binds it to the Form. It then makes it available to all the data controls in the Form. Why not just reference it by the same name in the different parts of the Form? Adrian Klaver aklaver@... _______________________________________________ Post Messages to: Dabo-users@... 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/2036606362.2051471256844384087.JavaMail.root@... |
|
|
Re: How to use BizObjsOn Thursday 29 October 2009 12:00:11 pm Aaron Carlow wrote:
> John, thanks for your help! One question I have about setting a dGrid > control's DataSource - when using ClassDesigner, is it better to assign the > DataSource within the Object Properties (thereby putting it into the XML > definition of the control) or by using the control's initProperties() > method? It may just be my system but ClassDesigner seems a bit "quirky" in > some of the Object Properties fields in that sometimes I get a boolean > checkbox instead of what should be a string value and this has me thinking > perhaps it is better to put that in the initProperties() method instead. > > Aaron L. Carlow Please help out and report the bug (supply a traceback if there is one - I recently forgot too). I don't use ClassDesigner very often. I hand code my forms. So not the best guy to ask. But I would use the ClassDesigner's object properties window (just save often). Use the force Luke. It's always best to work with Dabo rather than find a work around. I try very hard not to bypass Dabo or find work arounds. Johnf _______________________________________________ Post Messages to: Dabo-users@... 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/200910291230.33494.jfabiani@... |
|
|
Re: How to use BizObjsOn Oct 29, 2009, at 12:26 PM, Adrian Klaver wrote: > > I may be missing something but why do you need to create two > instances of the same bizobj? The self.addBizobj binds it to the > Form. It then makes it available to all the data controls in the > Form. Why not just reference it by the same name in the different > parts of the Form? I have a situation where I want to access the same table on two different dPages within the same form, but don't want manipulation on one dPage to change the cursor for the other. I think JohnF's recommendation on using a temporary cursor might be the best way to handle that unless someone else has a better idea. Aaron L. Carlow --- StripMime Report -- processed MIME parts --- multipart/alternative text/plain (text body -- kept) text/html --- _______________________________________________ Post Messages to: Dabo-users@... 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/DCDFB63E-2E96-43E9-BB30-A6E750CE1D41@... |
|
|
Re: How to use BizObjsOn Thursday 29 October 2009 5:38:34 pm Aaron L. Carlow wrote:
> On Oct 29, 2009, at 12:26 PM, Adrian Klaver wrote: > > I may be missing something but why do you need to create two > > instances of the same bizobj? The self.addBizobj binds it to the > > Form. It then makes it available to all the data controls in the > > Form. Why not just reference it by the same name in the different > > parts of the Form? > > I have a situation where I want to access the same table on two > different dPages within the same form, but don't want manipulation on > one dPage to change the cursor for the other. I think JohnF's > recommendation on using a temporary cursor might be the best way to > handle that unless someone else has a better idea. > > Aaron L. Carlow > I think I lost track of what you are trying to do. Does the second page contain a different record from the first or different fields or both? -- Adrian Klaver aklaver@... _______________________________________________ Post Messages to: Dabo-users@... 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/200910300649.29523.aklaver@... |
|
|
Re: How to use BizObjsOn Fri, Oct 30, 2009 at 6:49 AM, Adrian Klaver <aklaver@...> wrote:
> > > I think I lost track of what you are trying to do. Does the second page > contain > a different record from the first or different fields or both? > > I was trying to manipulate different records from the same table one two separate dPages within one dForm. Aaron L. Carlow --- StripMime Report -- processed MIME parts --- multipart/alternative text/plain (text body -- kept) text/html --- _______________________________________________ Post Messages to: Dabo-users@... 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/394973d50910300910i7d8583a5h7fb113cdd991bc16@... |
| Free embeddable forum powered by Nabble | Forum Help |