Subject Re: [IBO] Design question about master (master?) detail relation
Author Harald Klomann
mmenaz@... wrote:
>
> --- In IBObjects@y..., Harald Klomann <nibler@t...> wrote:
> > mmenaz@l... wrote:
> > >
> > > Hi, I've 3 tables, A that is sure the master one, B that is detail
> > > respect to A, and C that is a detail for the A and B current row,
> > > i.e.
> > > the A+B primary key are the foreign key for the C detail table.
> > > Since the TIB_Query has only one possible reference for a master
> > > datasource, what is the best way, eventually better code location,
> > > for
> > > solving this problem?
> > > ...
> >
> > Marco,
> >
> > just have a look to the MasterLinks Demo in the IBO´s Sample
> directory.
> > That looks exactly like what you trying to do.
> >
> > Harald
> I don't think so. MasterLinks Demo is a master(a) detail(b) detail(c)
> problem, where (b) is, alone, the master for (c).
> In my situation (c) is detail of (b) PLUS (a), since the (c) table
> unique index and foreign key is based on fields in (a) PLUS fields in
> (b). I think that the better solution could be redesign my database
> structure to bring it to master detail detail problem... You did not
> answer my question but gave me a better way of thinking...
> Thanks :)
> Marco Menardi

Marco,

I dont´t agree, your´s is also master detail detail.
You just have to setup right.


Here´s the solution :

Customer Query:
---------------
select * from customer

logical places Query
--------------------
select * from Places
MasterSource=CustomerDataSource
KeyLinks: placesno
custno
MasterLinks : places.custno=customer.custno


telephone numbers
-----------------
select * from phone
MasterSource=PlacesDataSource
KeyLinks: placesno
custno
telno
MasterLinks : phone.placesno=places.placesno
phone.custno=places.custno (or also possible: phone.custno=customers.custno



Of course, clear database design is allway the better solution :-)

Harald