Page 1 of 1

Master – detail

Posted: Fri 11 May 2007 08:37
by blackday
Hi

I have a master detail relation.
In master table I have got a field, which have a value (SUM of field in detail table).

In detail table on event After post: I wrote next statemets:
MainTable.Edit;
MainTable.FieldByName('nameofthefield').asFloat:= SUM Value; //EX: 12
MainTable.Post;


The problem is next: I am inserting a record in detail table. When I wont to moved into next record, detail table is getting in post state, but I am still in the same record, why do not wont to move in next record? Then I must tu press another demand to move cursor in next record.

Posted: Fri 11 May 2007 15:39
by Antaeus
Can you reproduce this problem with a SDAC demo? You can find SDAC demos in the SDAC_InstDir\Demos directory. SDAC_InstDir is the SDAC installation directory on your computer. If you can not, please send me small a sample to demonstrate this problem at evgeniyD*crlab*com, including script to create and fill tables.
Also supply me the following information:
- exact version of Delphi or C++Builder;
- exact version of SDAC. You can see it in the About sheet of TMSConnection Editor.

Note, the way you chose to implemented summation, may lead to data corruption if someone change data from other tool. Probably it would be better to implement summation inside a trigger, or to use a view insted of the column in your master table.