Ken Dibble wrote:
> Thanks, John.
>> Let me say I don't completely understand but I'll give a go by looking at 
>> your
>> code.
> 
> I'm using MySQL for the database.
> 
> I understand about using the underlying biz object code and issuing 
> requery() to run queries. I've never been comfortable using a fully 
> automated system with data-binding or views because they are only efficient 
> with very simple use cases, and my use cases are rarely that simple.
> 
> I want to use the Dabo biz object because it knows how to connect to the 
> back end and move data back and forth, but I need very fine-grained control 
> over everything else.
> 
> I'm having trouble explaining the concept of a link table. It's a very 
> common database concept. It contains nothing but its own integer pk field, 
> and integer foreign key fields that point to other tables. No 
> user-serviceable parts inside! I need to be able to get one of those FKs, 
> pass it to a routine that will find the matching PK in a record in one of 
> those other tables, and return a meaningful value from another field in 
> that record. Then I want to display that value on the form. Later, if some 
> user changes the meaningful value by picking another one from a list, I'll 
> have to call a routine that gets the PK for the new value and inserts that 
> into the link table (I'm not trying to model that now, though).
> 
> Based on your suggestions, I modified my form. The form runs but I'm now 
> getting an error when I press my button. The traceback is at the bottom of 
> this message.
> 
> Here's the code in my form:
> 
> ## *!* ## Dabo Code ID: dButton-dForm
> def onHit(self, evt):
>          biz = self.Form.getBizobj("myAuthors")
> 
>          # A spinner, used to select a PK value. Error occurs
>          # here, I think. The dSpinner control certainly does have
>          # a "value" attribute, but the traceback says it doesn't.
>          myPK = self.Form.keySpin.value
> 
>          biz.setWhereClause("myAuthors.id = " + str(myPK))
> 
>          # The textbox where I want to display the Author.
>          self.Form.thisAuthor.dataSource = "myAuthors"
> 
>          self.Form.refresh()
> 
> ## *!* ## Dabo Code ID: dForm-top
> def afterInit(self):
>          # This connection has been tested and works fine.
>          
> self.Application.addConnectFile("C:\DaboProjects\MyBooks\mybooks.cnxml")
> 
>          conn = self.Application.getConnectionByName("main")
> 
>          biz = dabo.biz.dBizobj(conn)
> 
>          biz.DataSource = "myAuthors"
> 
>          biz.KeyField = "id"
> 
>          self.addBizobj(biz)
> 
>          biz.addField("author")
> 
> Here's the traceback:
> 
> Traceback (most recent call last):
>    File "C:\Program Files\Dabo Runtime\dabo\lib\eventMixin.py", line 97, in 
> raiseEvent
>    File "c:\docume~1\kend\locals~1\temp\tmphd9tyv.py", line 96, in onHit
> AttributeError: 'dSpinner' object has no attribute 'value'
> Traceback (most recent call last):
>    File "C:\Program Files\Dabo Runtime\dabo\lib\eventMixin.py", line 97, in 
> raiseEvent
>    File "C:\Program Files\Dabo Runtime\ide\ClassDesignerFormMixin.py", line 
> 127, in onClose
>    File "ClassDesigner.py", line 1867, in designerFormClosing
> AttributeError: 'LayoutSizer' object has no attribute 'Form'
> 
> Thanks for your help!
> 
> Ken Dibble 
> 
> 

The error looks like if you put code in a LayoutSizer.
What is thisAuthor?

If you look at the code from my testproject (link was provided by me),
you can see various code where you might get a clue on how things work.

Uwe

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users

Reply via email to