Page 1 of 1

Derived Master - Detail Field

Posted: Tue 10 Nov 2009 21:04
by waheed
Problem Description:
I have Master Detail connection problem:

Master key values are
0, 100, 200, 300, 400, 500, 600, ..., 900

Detail key values are
10, 20, 110, 120, 130, 410, 420, ... 990

If I don't want to change the structure of the table, how can I create a master/detail relationship between them.

Here is my trial solution which I didn't know how to finish:

Master Query:
Select mkey, mname
from Mast

Detail Query:
SELECT dkey, dname,
(codeid DIV 100 * 100) AS CalKey
FROM Det
where CalKey=:mkey

then in the detail MyQuery component I set the MasterSource Prop to the master MyQuery component . And the MasterField to the master mkey. And the DetailFields to CalKey

This didn't work (the error was "#42S22Unknown column 'CalKey' in 'where clause'.", what is the proper way to do this?

Posted: Thu 12 Nov 2009 14:30
by Dimon
Try to use the following detail query:

Code: Select all

SELECT dkey, dname
FROM Det 
where (codeid DIV 100 * 100)=:mkey 

Posted: Thu 12 Nov 2009 15:32
by waheed
Thaaaaanks, this did it.