Subject | Re: [IBO] Transaction with master-child relationship |
---|---|
Author | Alfred Seetoh |
Post date | 2003-12-08T09:43:34Z |
--- In IBObjects@yahoogroups.com, James Chua <james_027@t...> wrote:
and added a foreign key on ID to reference CUSTOMER.CUST_ID. Changed
the KeyLinks property of QueryAddress to ADDRESS.ID and
ADDRESS.ADDRESS_TYPE. MasterLinks property remains as it is.
Result? It still won't work!
> Hi therewrote:
>
> Alfred Seetoh wrote:
>
> > --- In IBObjects@yahoogroups.com, Helen Borrie <helebor@t...>
> > > At 07:03 AM 8/12/2003 +0000, you wrote:CUSTOMER
> > > >Hi,
> > > > I encounter a *scratch-head* reaction with my master-child
> > > >relationship transaction. My master and child tables are
> > andthe
> > > >ADDRESS respectively. I've set their relationship according to
> > > >TransactionsHandling tutorial lesson 2.to-
> > > >
> > > >Info on child IB_Query:
> > > > MasterLinks: ADDRESS.ID=CUSTOMER.CUST_ID
> > > > MasterSource: DSCustomer
> > >
> > > Are you sure this relationship is correct? Surely, your detail-
> > masterand
> > > link should be through a foreign key in the ADDRESS table -
> > ADDRESS.CUST_ID
> > > or something similar. ADDRESS.ID seems like it would be the
> > > **primary key** of the address table....
> >
> > The primary key of ADDRESS table is (ID, ENTITY, ADDRESS_TYPE). I
> > intend to use this table to store addresses of customers, vendors
> > etc. Therefore I have the ENTITY field to identify the address isfor
> > what kind of entity. ID will be the ID of that entity.ADDRESS_TYPE
> > will be either 'Billing', 'Delivery' and etc.can't.
> >
> > I did not create a foreign key in my ADDRESS table because I
> > This table *references* different tables based on the ENTITYfield.
> >won't
> > Do you mean the absence of a foreign key is the reason why it
> > work?referring to
> >
> Helen is right. Your master child relationship ins't setup right. I
> though the ID field you have their in your address table is
> the customer ID in your customer table. You should have a field inyour
> address table that is a foreign key that points to the customer idin
> your customer table. Then if you re setup your mater childrelationship
> correctly, everything will work out fine.Ok, I changed my ADDRESS table's primary key to (ID, ADDRESS_TYPE),
>
> James
and added a foreign key on ID to reference CUSTOMER.CUST_ID. Changed
the KeyLinks property of QueryAddress to ADDRESS.ID and
ADDRESS.ADDRESS_TYPE. MasterLinks property remains as it is.
Result? It still won't work!