Master/Detail field linking
Posted: Thu 04 Aug 2016 07:07
I am looking at converting a massive application to UniDac. This involves a lot of master/detail tables. Since this was done in the early days of dbExpress, I had a TNewTable component written to simulate a TTable component which also included master detail linking with SQL commands similar to how UniDac does it.
I need to clarify the UniDac's operation of the master/detail links.
This is from the help file:
Is it possible to have this work where it looks at the parameters and links any matching with master field names, or is it not possible? This would skip the foreign key requirement and just look for fields in the master table with the same name as the parameter. My TNewTable component did it with DataLinks, based on how the original TTable component worked, I am not sure how yours works.
The second method in the help file is to specify the fields.
I have thousands of these links in the application so need something that translates.
Thanks.
I need to clarify the UniDac's operation of the master/detail links.
This is from the help file:
This matches my system in place already, however none of the tables linked with foreign keys. In some cases the linking is ad-hoc so wouldn't be foreign key linked anyway (for example a postcode).parameter name in detail dataset SQL must be equal to the field name in the master dataset that is used as foreign key for detail table.
Is it possible to have this work where it looks at the parameters and links any matching with master field names, or is it not possible? This would skip the foreign key requirement and just look for fields in the master table with the same name as the parameter. My TNewTable component did it with DataLinks, based on how the original TTable component worked, I am not sure how yours works.
The second method in the help file is to specify the fields.
I could convert my code to this scenario, however what about other conditions in the where clause? The help file says:// setup MD
Detail.MasterFields := 'Dept_No'; // primary key in Department
Detail.DetailFields := 'DepLink'; // foreign key in Employee
The where clause might contain other filtering criteria as well as the master/detail link. For example all the orders for customer (master/detail), but only over $1000 (where clause). Does UniDac honor the where clause for the other criteria and just append its own criteria?Also note that there are no WHERE clause in detail dataset SQL.
I have thousands of these links in the application so need something that translates.
Thanks.