I don't normally define the datasource either and also generally only use
the addField but thought I would do the whole shebang this time around.
Perhaps I need to revisit that and see if I have any better luck.

Carey

On Sat, Jan 5, 2013 at 2:36 PM, John Fabiani <[email protected]> wrote:

> On 01/05/2013 11:51 AM, Carey Gagnon wrote:
>
>> I have inherited a database that in my opinion was designed very badly,
>> and
>> now I am having a hard time wrapping my head around what I need to do so
>> that dabo and the mssql database play nice together.
>>
>> I have 3 tables where I have to pull fields into table one from tables 2 &
>> 3. Problem is, the fields I need to pull in all have the same names. I
>> have
>> tables 2 (Cities) and table 3 (ProvinceState) playing nice together but I
>> can't get table 1 into the mix as well.
>>
>>
>> TABLE 1 (Companies)
>>
>> self.DataStructure = (
>>                  ("CompanyID", "I", True, "dbo.Companies", "CompanyID"),
>>                  ("CompanyName", "C", False, "dbo.Companies",
>> "CompanyName"),
>>                  ("Address", "C", False, "dbo.Companies", "Address"),
>>                  ("City", "C", False, "dbo.Companies", "City"),
>> ############################ Needs to be filled from Cities Table
>>
>>                  ("CityID", "I", False, "dbo.Companies", "CityID"),
>> ########################### A dropdown to pull cities Choices & Keys from
>> Cities Table
>>                  ("ProvinceState", "C", False, "dbo.ProvinceState.",
>> "ProvinceState"), ########## Needs to be filled from Cities table as part
>> of CityID
>>                  ("Country", "C", False, "dbo.ProvinceState", "Country"),
>> ##################### Needs to be filled from ??? to match the value of
>> CityID in cities table
>>                  ("PostalZIP", "C", False, "dbo.Companies", "PostalZIP"),
>>                  ("Phone", "C", False, "dbo.Companies", "Phone"),
>>                  ("Fax", "C", False, "dbo.Companies", "Fax"),
>>                  ("Website", "C", False, "dbo.Companies", "Website"),
>>                  ("InactiveCompany", "I", False, "dbo.Companies",
>> "InactiveCompany"),
>>                  ("CompanyActivationDate", "T", False, "dbo.Companies",
>> "CompanyActivationDate"),
>>                  ("CompanyInactivationDate", "T", False, "dbo.Companies",
>> "CompanyInactivationDate"),
>>                  ("CompanyCreator", "C", False, "dbo.Companies",
>> "CompanyCreator"),
>>                  ("ParentCompanyID", "I", False, "dbo.Companies",
>> "ParentCompanyID"),
>>                  ("CompanyRating", "C", False, "dbo.Companies",
>> "CompanyRating"),
>>          )
>>
>>
>> TABLE 2 (Cities)
>>
>> self.DataStructure = (
>>                  ("CityID", "I", True, "dbo.Cities", "CityID"),
>>                  ("CityName", "C", False, "dbo.Cities", "CityName"),
>>                  ("ProvinceState", "C", False, "dbo.Cities",
>> "ProvinceState"),
>>                  ("Country", "C", False, "dbo.ProvinceState", "Country"),
>> ################## Pulled In from Table 3 with addJoin and addField
>>          )
>>
>>
>> TABLE 3 (ProvinceState)
>>
>> self.DataStructure = (
>>                  ("ProvinceState", "C", True, "dbo.ProvinceState",
>> "ProvinceState"),
>>                  ("Country", "C", False, "dbo.ProvinceState", "Country"),
>>          )
>>
>> Again, I don't have the option of changing the tables and not matter what
>> I
>> do I can't seem to get it right. I either end up with a Ambiguous field
>> error or I get the values that were previously entered into the Companies
>> table when it was stand alone (more correct to say before it relied on the
>> Cities table)
>>
>> I know this isn't really a dabo specific question, but if anyone can help
>> me wrap my head around this it would be greatly appreciated.
>>
>> Thanks
>> Carey
>>
>>
>>
>>  I normally do NOT set the DataStructure.  I just create the bizobj class
> as in:
>
> class Public_esclient_Bizobj(dabo.**biz.dBizobj):
>
>     def afterInit(self):
>         self.addFrom( "public.esclient")
>         self.addField("esclient.**languageid")
>         self.addField("esclient.**locationid")
>         self.addField("esclient.ssn")
>         self.addField("esclient.lname"**)
>         self.addField("esclient.fname"**)
>         self.addField("esclient.mname"**)
>         self.addField("esclient.sname"**)
>         self.addField("esclient.pname"**)
>         self.addField("esclient.**dvrslic")
>         self.addField("esclient.**dvrslicst")
>         self.addField("esclient.born")
>         self.addField("esclient.**address")
>         self.addField("esclient.**address2")
>         self.addField("esclient.city")
>         self.addField("esclient.state_**1")
>         self.addField("esclient.zip")
>         self.addField("esclient.**homephone")
>         self.addField("esclient.**workphone")
>         self.addField("esclient.**phoneext")
>
> In the class you can name the field i.e.
>
> class Public_esclient_Bizobj(dabo.**biz.dBizobj):
>
>     def afterInit(self):
>         self.addFrom( "public.esclient as person")
>         self.addField("esclient.**languageid as lang")
>
> Here I have change the field name from "esclient" to "person" and
> "languageid" as "lang"
> You can do the same thing in your model for any of the tables.
>
> Johnf
>
>
>
> ______________________________**_________________
> Post Messages to: [email protected]
> Subscription Maintenance: http://mail.leafe.com/mailman/**
> listinfo/dabo-users <http://mail.leafe.com/mailman/listinfo/dabo-users>
> Searchable Archives: 
> http://leafe.com/archives/**search/dabo-users<http://leafe.com/archives/search/dabo-users>
> This message: http://leafe.com/archives/**byMID/50E88ECF.7090407@**
> jfcomputer.com<http://leafe.com/archives/byMID/[email protected]>
>


--- StripMime Report -- processed MIME parts ---
multipart/alternative
  text/plain (text body -- kept)
  text/html
---
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: 
http://leafe.com/archives/byMID/camgtpffbk7us8rfcyhqf0qbpyl8qmimb3ns0dlluzjromym...@mail.gmail.com

Reply via email to