[dabo-users] Child doesn't relate to Parent

Author: Dewald Jacobs

Posted: 2011-11-22 at 22:33:00

Hi,

I have set up a simple app involving a parent-child relation. I followed the screencast "Using the Data Environment" part 1 and 2. I also took into account the following post and my app looks exactly the same (except for the names):

Got this from the following thread: http://www.mail-archive.com/dabo-users@leafe.com/msg14437.html

I am not aware of a screencast named "Using Data Environment". So I can't

directly comment.

However, there is no way to use one bizobj and setup a parent child

relationship. See below of example code of a parent child relationship.

Note that the parent is the customer class and the child is the contacts

class. A customer (maybe a company) can have many contacts - a one to many

relationship. In the child (the contact class) there are two lines of the

class that describes the relation so Dabo can maintain the relationship.

self.LinkField = "fk_arcust"

self.ParentLinkField ="pkid"

So when you move the customer record pointer Dabo will retrieve the contacts

data related to the customer.

> #the contact table

> class PubliccontactsBizobj(dabo.biz.dBizobj):

> def afterInit(self):

> self.DataSource = "public.contacts"

> self.KeyField = "pkid"

> self.addFrom("public.contacts")

> self.addField("firstname")

> self.addField("phone")

> self.addField("pkid")

> self.addField("lastname")

> self.addField("title")

> self.addField("custno")

> self.addField("continent")

> self.addField("email")

> self.addField("cont_note")

> self.addField("fk_arcust")

> self.NonUpdateFields=["pkid"]

> self.LinkField = "fk_arcust"

> self.ParentLinkField ="pkid"

> self.FillLinkFromParent = True

> #the customer table

> class PublicarcustBizobj(dabo.biz.dBizobj):

> def afterInit(self):

> self.DataSource = "public.arcustomer"

> self.addFrom("public.arcustomer")

> self.KeyField = "pkid"

> self.addField("czip")

> self.addField("city")

> self.addField("pkid")

> self.addField("state")

> self.addField("company")

> self.addField("address1")

> self.addField("address2")

> self.addField("country")

> self.addField("custno")

The problem is that the child is not behaving like it does in the screencast. It simply displays everything from child table in the grid. In the screencast only the related content from the child would be shown to correspond to the LinkField. This can be seen in the middle of the second screencast (part 2). Is there something I am missing or doing wrong?

I have tested and played around with LinkField and ParentLinkField but it makes no difference at all. Exact same result every time. Any help would be appreciated.

Thanks

Dewald

PS. links to the screencasts if needed:

http://c0129431.cdn.cloudfiles.rackspacecloud.com/dataenvironment1.html

http://c0129431.cdn.cloudfiles.rackspacecloud.com/dataenvironment2.html

--- StripMime Report -- processed MIME parts ---

multipart/alternative

text/plain (text body -- kept)

text/html

---

_______________________________________________

Post Messages to: Dabo-users@leafe.com

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/49737C1E-CB50-4EC0-B044-7F109487B66B@gmail.com

©2011 Dewald Jacobs