On 02/07/10 17:13, Jacek Kałucki wrote:
> Użytkownik sim napisał:
>
>> On 2/7/2010 4:20 PM, Ed Leafe wrote:
>>
>>
>>> On Feb 7, 2010, at 8:54 AM, sim wrote:
>>>
>>>
>>>
>>>
>>>> I have a table with multiple foreign keys.
>>>>
>>>> a) How can I mark multiple fields as the LinkField?
>>>>
>>>>
>>>>
>>> The LinkField is set on the child, or dependent, bizobj. A child can
>>> only be dependent on a single parent.
>>>
>>>
>>>
>> Lets say I have a 3 tables: Products, Users and UserProducts.
>> UserProducts has 2 FKs , ProductID and UserID, showing which products
>> are used by which user.
>> I create 3 bizobjs, one for each table.
>> Should UserProducts be a child of Users or Products?
>>
>>
> Hi,
>
> If you want to have something like this:
>
> UserProducts
> ( (______________ Users
> (________________ Products
>
> I think your code should be (assume PK name in child tables are "pk_id"):
>
> boUserProducts = app.biz.UserProducts()
> boProducts = app.biz.Products(LinkField="pk_id",
> ParentLinkField="ProductID")
> boUsers = app.biz.Users(LinkField="pk_id", ParentLinkField="UserID")
> boUserProducts.addChild(boProducts)
> boUserProducts.addChild(boUsers)
>
> Unfortunately, Dabo doesn't support NULL parent child links :(
> So, you probably receive exceptions for None FK fields.
> But If you _really_ need this feature, I can send you custom classes that
> extends Dabo to support this.
>
I'm still having a bit of trouble getting my head around linking.
I have 2 bizobjs:
Customers and Calls
My dform contains one sizer with customer information and another sizer
that contains a grid listing the calls to that customer.
The Customer bizobj sets self.KeyField = "customerid"
My CreateBizobj function contains
app=self.Application
self.Connection = app.getConnectionByName("thedb")
customers=app.biz.CustomerBizobj(self.Connection)
lookups = app.biz.LookupBizobj(self.Connection)
calls=app.biz.CallsBizobj(self.Connection,LinkField="customerid")
self.addBizobj(customers)
self.addBizobj(lookups)
customers.addChild(calllogs)
When I start the form, I get the first customer data and the call grid
lists all the calls for all customers. When I click the next button
(self.next()), it goes to the next customer and still lists all the
calls. When I remove the addChild call then no calls show up, so I know
that it is making some sort of connection between them.
Thanks
Sim
_______________________________________________
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]