Board index » delphi » Question on setting up master-detail tables

Question on setting up master-detail tables

I have 2 tables (in DBF):

Master:
           Transaction # (key)
           ...

Child:
           Transaction # (key)
           Item #
           ...

I want to line the 2 using "transaction #", and order the child table
by "trans # + item #" (it's already indexed). I'd changed the
MasterSources
and MasterFields properties of the child without success. I'd already
reported here that I'd got the "Field index out of range" error from
BDE. One nice guy told me to use the filtering method, but I'd found
this too troublesome under my case, which is quite complicated. Is there
some way to utilize Delphi's master-detail relation under my case?

Gary Tse.

+---------------------------------------------------------------------
|
| Q: Who's the guy that sold you something for plenty of bucks,
|    but'll tell you "Wow, ok, it's our *unique* feature (set).",
|    after the beast'd killed all what you have done this morning?
|
+---------------------------------------------------------------------

******* Please remove DO_NOT_SPAM_2_ to send me sweet letter! *******

 

Re:Question on setting up master-detail tables


I have the same problem several months back.  Tried to do what you are
currently doing but it doesn't seem to work for DBASE files (I presume since
you stated DBF).  Some guy from Borland (then) email me a message saying the
method works for Paradox files but is not supported for DBASE files.  I
settled for the OnFilterRecord eventually.

Peter Tan

Re:Question on setting up master-detail tables


On Fri, 04 Sep 1998 19:44:30 -0800, Gary Tse

Quote
<DO_NOT_SPAM_2_garyk...@hknet.com> wrote:
>I want to line the 2 using "transaction #", and order the child table
>by "trans # + item #" (it's already indexed). I'd changed the
>MasterSources
>and MasterFields properties of the child without success. I'd already
>reported here that I'd got the "Field index out of range" error from
>BDE. One nice guy told me to use the filtering method, but I'd found
>this too troublesome under my case, which is quite complicated. Is there
>some way to utilize Delphi's master-detail relation under my case?

You could use a Query for your child table, like:

SELECT * FROM Child WHERE TransactionNo=:TransactionNo ORDER BY ItemNo

If you want to have RequestLive=TRUE then you need an additional
maintained index on ItemNo. Connect Query.Datasource to your master
tables datasource as usual to establish the master-detail relation
(in this case master=TTable detail=TQuery). Should work (at least it
works here ... I just tested a sample, since I usually don't use DBF).

HTH
Helge Pretzlaff

Other Threads