johnf wrote:
> On Monday 10 November 2008 08:58:14 pm Paul McNett wrote:
>> johnf wrote:
>>> Paul said
>>>
>>>> You can use a table as many times as you want. You can instantiate as
>>>> many instances of the same bizobj as you like. You can even add these
>>>> redundant bizobjs to the form using addBizobj() if you want, but you
>>>> have to give each one a unique DataSource so the form can differentiate
>>>> between them.
>>>>
>>>> first  = biz.Customers(conn, DataSource="Customers")
>>>> second = biz.Customers(conn, DataSource="Customers1")
>>> I have attempted to follow your instructions for adding a second bizobj
>>> that uses the same table.  It appears it does not work - or I don't
>>> understand how I'm suppose to assign the correct DataSource.
>>>
>>> In both dbMySQL.py and dbPostgres.py the method getFields(self,
>>> tableName) exist.  In both cases the tableName comes directly from the
>>> setting of the DataSource in the bizobj.  So if I change the DataSource
>>> to anything other than the correct table name it will fail.  Your example
>>> show two DataSources. Assuming a table name of "Customer"
>>>
>>> the "first" - will work
>>>
>>> the "second" - will NOT work.
>>>
>>> How can I fix this?
>> By explicitly setting up your sql, like:
>>
>> self.addFrom("Customers")
>>
>> Paul
> 
> Have you actually tried this?  
> 
> This is what I did:
> 
> Class FirstBiz(dabo.biz.dBizobj):
>     def afterInit(self):
>       self.DataSource = "arcadr"
>       self.KeyField = "pkid"
>       self.addFrom("arcadr")
>       self.addField("ccustno")
>       self.addField("czip")
> 
> Class SecondBiz(dabo.biz.dBizobj):
>     def afterInit(self):
>       self.DataSource = "arcadr2"
>       self.KeyField = "pkid"
>       self.addFrom("arcadr")
>       self.addField("ccustno")
>       self.addField("czip")
> 
> I get immediate error from getFields().  The getFields() is passed 
> the "tableName".  Which comes directly from the DataSource.  And of course 
> there is no "arcadr2"  
> 
> I see that you are using "addFrom()"  is this the difference?  I 
> thought "addFrom()" is the string used in the SQL for the 'from' as in:
> select * from arcadr.

The difference is probably that I've taken to setting DataStructure explicitly, 
which 
causes Dabo to not have to find it implicitly with getFields(), et al.

Paul



_______________________________________________
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]

Reply via email to