morpheus
21st December 2002, 07:00
Hello,
There is a main table (1), with 5 fields in it's only index. There is another table (2), with 3 fields in it's only index. These 3 fields are the sub-set of the earlier mentioned 5 fields. I need table2 to refer to table1. I made a combined field in table2, comprising of those 3 fields. I will have to make another combined field in table1, comprising of these 3 fields, and put it as index1. But, I do not want to create another index in table1. Is there any other way out!?

~Vamsi
21st December 2002, 20:28
If the parent table has more fields in the index than the child table you cannot enforce referential integrity :confused:. An example would be Purchase Orders (one field in the key), lines (more than one field). Lines can refer to Orders but not the other way.

If that is resolved, you can always enforce referential integrity in your program scripts. Write code expicitly that checks for the existence of the parent table values (boring and time consuming). For my previous example you can do the following in a lot of places:
select tdsls400._index1
from tdsls400
where tdsls400._index1 = {:tdsls401.orno}
as set with 1 rows
selectdo
selectempty
|Error!
endselect

morpheus
23rd December 2002, 07:56
Thanks Vam.
I think I'll go for another index, than the code.