Subject | Re: [IBO] Transaction with master-child relationship |
---|---|
Author | James Chua |
Post date | 2003-12-08T09:32:12Z |
Hi there
Alfred Seetoh wrote:
though the ID field you have their in your address table is referring to
the customer ID in your customer table. You should have a field in your
address table that is a foreign key that points to the customer id in
your customer table. Then if you re setup your mater child relationship
correctly, everything will work out fine.
James
Alfred Seetoh wrote:
> --- In IBObjects@yahoogroups.com, Helen Borrie <helebor@t...> wrote:Helen is right. Your master child relationship ins't setup right. I
> > At 07:03 AM 8/12/2003 +0000, you wrote:
> > >Hi,
> > > I encounter a *scratch-head* reaction with my master-child
> > >relationship transaction. My master and child tables are CUSTOMER
> and
> > >ADDRESS respectively. I've set their relationship according to the
> > >TransactionsHandling tutorial lesson 2.
> > >
> > >Info on child IB_Query:
> > > MasterLinks: ADDRESS.ID=CUSTOMER.CUST_ID
> > > MasterSource: DSCustomer
> >
> > Are you sure this relationship is correct? Surely, your detail-to-
> master
> > 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 and
> etc. Therefore I have the ENTITY field to identify the address is for
> what kind of entity. ID will be the ID of that entity. ADDRESS_TYPE
> will be either 'Billing', 'Delivery' and etc.
>
> I did not create a foreign key in my ADDRESS table because I can't.
> This table *references* different tables based on the ENTITY field.
>
> Do you mean the absence of a foreign key is the reason why it won't
> work?
>
though the ID field you have their in your address table is referring to
the customer ID in your customer table. You should have a field in your
address table that is a foreign key that points to the customer id in
your customer table. Then if you re setup your mater child relationship
correctly, everything will work out fine.
James