Subject | Re: [IBO] Transaction with master-child relationship |
---|---|
Author | Alfred Seetoh |
Post date | 2003-12-08T09:53:55Z |
--- In IBObjects@yahoogroups.com, Helen Borrie <helebor@t...> wrote:
when I view different customer record, the respective addresses did
appear correctly.
ADDRESS.ID
ADDRESS.ADDRESS_TYPE
KeySource: *Blank*
MasterSource: DSCustomer
MasterLinks: ADDRESS.ID=CUSTOMER.CUST_ID
> At 09:07 AM 8/12/2003 +0000, you wrote: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_TYPEADDRESS.ID
> >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?
>
> The *wrong* key would prevent it from working. But if this
> column carries the PK of the CUSTOMER table, it should be OK.Yes. ADDRESS.ID does contain data from CUSTOMER.CUST_ID. In fact,
when I view different customer record, the respective addresses did
appear correctly.
> The next place to look is the KeyLinks of the ADDRESS query. Doyou have
> *all* of its primary key columns in KeyLinks? And make sure thatthe
> KeySource property of the detail dataset is Nil.KeyLinks of QueryAddress:
ADDRESS.ID
ADDRESS.ADDRESS_TYPE
KeySource: *Blank*
MasterSource: DSCustomer
MasterLinks: ADDRESS.ID=CUSTOMER.CUST_ID
> Helen