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
Author: Jacek Kałucki
Posted: 2011-11-23 03:27:25 Link
Użytkownik Dewald Jacobs napisał:
> 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.
Hi.
Did you check database activity log first?
If not, please post here public.contacts table requery entry from it.
--
Regards
Jacek Kałucki
_______________________________________________
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/4ECCAE6D.6090801@rz.onet.pl
Author: Dewald Jacobs
Posted: 2011-11-23 04:31:59 Link
Hi. I'm not familiar with the database activity log. How do I enable and check it?
Thanks for the response.
Dewald
On 23 Nov 2011, at 10:27 AM, Jacek Kałucki wrote:
> Użytkownik Dewald Jacobs napisał:
>> 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.
>
> Hi.
>
> Did you check database activity log first?
> If not, please post here public.contacts table requery entry from it.
>
> --
> Regards
> Jacek Kałucki
> _______________________________________________
> 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/4ECCAE6D.6090801@rz.onet.pl
_______________________________________________
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/37997167-F006-4089-91B5-08A77CE4AD94@gmail.com
Author: Jacek Kałucki
Posted: 2011-11-23 04:39:34 Link
Użytkownik Dewald Jacobs napisał:
> Hi. I'm not familiar with the database activity log. How do I enable and check it?
In your Dabo application directory where the startup script is located
add file "settings_override.py" with the entry like:
dbLogFile = "database.log"
Then you will be able to monitor framework database activity.
--
Regards
Jacek Kałucki
_______________________________________________
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/4ECCBF56.8070004@rz.onet.pl
Author: Sibylle Koczian
Posted: 2011-11-23 04:47:02 Link
Hello,
Am 23.11.2011 04:33, schrieb Dewald Jacobs:
>
> 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.
>
Have you got a call to dBizobj.addChild() in your createBizobjs method?
Something like this:
parentbiz = PublicarcustBizobj(myDatabaseconnection)
childbiz = Publiccontactsbizobj(myDatabaseconnection)
parentbiz.addChild(childbiz)
HTH
Sibylle
_______________________________________________
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/4ECCC116.1000804@t-online.de
Author: Dewald Jacobs
Posted: 2011-11-23 06:46:15 Link
Thanks. I'm still not sure what I'm doing wrong even with the output of the log. Here are the 2 relevant bizobj's, my *creatBizobj and also the output of the log.
GeskiedenisBizobj
import dabo
class GeskiedenisBizobj(dabo.biz.dBizobj):
def afterInit(self):
self.DataSource = "Geskiedenis"
self.KeyField = "pkid"
self.Linkfield = "Nr"
self.ParentLinkField = "pkid"
self.FillLinkFromParent = True
self.addFrom("Geskiedenis")
self.addField("Notas")
self.addField("Datum")
self.addField("Gebeurtenis")
self.addField("Geslag van kalf")
self.addField("Bul")
self.addField("Nr")
self.addField("pkid")
def validateRecord(self):
"""Returning anything other than an empty string from
this method will prevent the data from being saved.
"""
ret = ""
# Add your business rules here.
return ret
KuddeBizobj
import dabo
class KuddeBizobj(dabo.biz.dBizobj):
def afterInit(self):
self.DataSource = "Kudde"
self.KeyField = "pkid"
self.addFrom("Kudde")
self.addField("Grootmoeder ID")
self.addField("Notas")
self.addField("pkid")
self.addField("Moeder ID")
self.addField("Geboortedatum")
self.addField("ID Nommer")
self.addField("Grootvader ID")
self.addField("Vader ID")
def validateRecord(self):
"""Returning anything other than an empty string from
this method will prevent the data from being saved.
"""
ret = ""
# Add your business rules here.
return ret
*createBizobj
def createBizobjs(self):
kuddeBizobj = self.Application.biz.KuddeBizobj(self.Connection)
self.addBizobj(kuddeBizobj)
geskiedenisBizobj = self.Application.biz.GeskiedenisBizobj(self.Connection)
self.addBizobj(geskiedenisBizobj)
kuddeBizobj.addChild(geskiedenisBizobj)
And the log output:
2011-11-23 13:31:56 - INFO - execute() SQL: select * from sqlite_master
2011-11-23 13:34:46 - INFO - execute() SQL: select "Grootmoeder ID", "Notas", "pkid", "Moeder ID", "Geboortedatum", "ID Nommer", "Grootvader ID", "Vader ID" from "Kudde" limit 1
2011-11-23 13:34:46 - INFO - execute() SQL: pragma table_info('Kudde')
2011-11-23 13:34:46 - INFO - execute() SQL: select "Grootmoeder ID", "Notas", "pkid", "Moeder ID", "Geboortedatum", "ID Nommer", "Grootvader ID", "Vader ID" from "Kudde" limit 1000
2011-11-23 13:34:46 - INFO - execute() SQL: select "Notas", "Datum", "Gebeurtenis", "Geslag van kalf", "Bul", "Nr", "pkid" from "Geskiedenis" limit 1
2011-11-23 13:34:46 - INFO - execute() SQL: pragma table_info('Geskiedenis')
2011-11-23 13:34:46 - INFO - execute() SQL: select "Notas", "Datum", "Gebeurtenis", "Geslag van kalf", "Bul", "Nr", "pkid" from "Geskiedenis" limit 1000
2011-11-23 13:34:54 - INFO - execute() SQL: select "Notas", "Datum", "Gebeurtenis", "Geslag van kalf", "Bul", "Nr", "pkid" from "Geskiedenis" limit 1000
2011-11-23 13:34:55 - INFO - execute() SQL: select "Notas", "Datum", "Gebeurtenis", "Geslag van kalf", "Bul", "Nr", "pkid" from "Geskiedenis" limit 1000
Any idea what I am doing wrong or forgetting?
Thanks
Dewald
On 23 Nov 2011, at 11:39 AM, Jacek Kałucki wrote:
> Użytkownik Dewald Jacobs napisał:
>> Hi. I'm not familiar with the database activity log. How do I enable and check it?
>
> In your Dabo application directory where the startup script is located
> add file "settings_override.py" with the entry like:
>
> dbLogFile = "database.log"
>
> Then you will be able to monitor framework database activity.
> --
> Regards
> Jacek Kałucki
> _______________________________________________
> 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/4ECCBF56.8070004@rz.onet.pl
--- 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/998C5661-8FE8-43CC-B02C-D0D3A67F680C@gmail.com
Author: Jacek Kałucki
Posted: 2011-11-23 07:16:23 Link
Użytkownik Dewald Jacobs napisał:
> self.Linkfield = "Nr"
Shouldn't it be:
self.LinkField = "Nr"
--
Regards
Jacek Kałucki
_______________________________________________
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/4ECCE417.40801@rz.onet.pl
Author: Dewald Jacobs
Posted: 2011-11-23 07:29:45 Link
Speechless.
I found the original mistake earlier (a change in the name of the LinkField in the original database), but somewhere along the line I must have mistyped LinkField so it just never worked.
Just fixed it and it works.
Thanks so much.
On 23 Nov 2011, at 2:16 PM, Jacek Kałucki wrote:
> Użytkownik Dewald Jacobs napisał:
>> self.Linkfield = "Nr"
>
> Shouldn't it be:
> self.LinkField = "Nr"
>
> --
> Regards
> Jacek Kałucki
> _______________________________________________
> 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/4ECCE417.40801@rz.onet.pl
_______________________________________________
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/B8FA33F6-4E8A-40D2-9321-74C3CC3B9DD4@gmail.com
Author: Dewald Jacobs
Posted: 2011-11-23 09:38:03 Link
Hi again,
How would I proceed if I want to have an input form along with the grid for the child table? Just point me in the right direction and I will try and figure out the rest.
Thanks again. Trying my best to learn python (Learning Python 4th Edition) and dabo at the moment so sorry if the questions are very basic.
Regards
Dewald
On 23 Nov 2011, at 2:16 PM, Jacek Kałucki wrote:
> Użytkownik Dewald Jacobs napisał:
>> self.Linkfield = "Nr"
>
> Shouldn't it be:
> self.LinkField = "Nr"
>
> --
> Regards
> Jacek Kałucki
> _______________________________________________
> 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/4ECCE417.40801@rz.onet.pl
_______________________________________________
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/F95A8E62-1477-4517-BC04-366F81CA2B00@gmail.com
Author: John Fabiani
Posted: 2011-11-23 09:57:54 Link
On Wednesday, November 23, 2011 04:38:03 PM Dewald Jacobs wrote:
> Hi again,
>
> How would I proceed if I want to have an input form along with the grid for
> the child table? Just point me in the right direction and I will try and
> figure out the rest.
>
> Thanks again. Trying my best to learn python (Learning Python 4th Edition)
> and dabo at the moment so sorry if the questions are very basic.
>
> Regards
> Dewald
>
> On 23 Nov 2011, at 2:16 PM, Jacek Kałucki wrote:
> > Użytkownik Dewald Jacobs napisał:
> >> self.Linkfield = "Nr"
> >
> > Shouldn't it be:
> > self.LinkField = "Nr"
First welcome to Dabo!
Add the controls you need to the form. Associate the control's DataSource and
DataField that match the DataSource and columns.
So I have a grid with the DataSource = "Geskiedenis" and it has a columns
"Notas", and "Datum"
I would add two textboxes as follows:
dabo.ui.dTextBox(self,
RegID="NotasID",DataSource='public.Geskiedenis',DataField='Notas')
dabo.ui.dTextBox(self,
RegID="DatumD",DataSource='public.Geskiedenis',DataField='Datum')
#Note review the Doc's for the reason I added a "RegID" a very cool feature of
Dabo.
If you are using the ClassDesigner to create the form then just drag and drop
the control on the form and then associate the correct DataSource and
DataField.
As you move from row to row on the grid the data in the textboxes will follow.
It is best if you have a new question to start a new thread. Also did you
sign up for the list?
John
_______________________________________________
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/4641624.mr5SgtmQzh@linux-12