I have master-detail linked tables
For some editing in the master on all records I call disablecontrols and then update the master records.
For each record I edit however the child is incorrectly marked as fetched.
After debugging I notice that my post calls InternalBeforePost … ReplaceMasterKey … AddMasterKey
The key of my master record did not change, however I noticed that ReplaceMasterKey compares theTDAMasterKeyID pointers instead of the content ( if aOldKey = aNewKey then Exit;)
Is this a bug?
If so, can it be fixed?
If not, am I doing something wrong? How can we edit master records while controls (childs) are disabled?
FYI: I am using RO v9.3.105.1351
TIA
It would take me some time to create a test application.
I was hoping the information I gave sufficed.
I would expect that in TDADataTable.ReplaceMasterKey
the line
if aOldKey = aNewKey then Exit;
would need to become something like
if TDAMasterKeyList_Compare(aOldKey,aNewKey)=0 then Exit;
Please let me know if the sample is absolutely necessary
-A busy programmer-
procedure TDADataTable.InternalBeforePost_DoEdit;
...
if dt.Active and (dt.fOldMasterKey <> nil)
and (dt.fFetchedMasters.IndexOf(dt.fOldMasterKey)<>-1) //this line was added
then
Note: I am not sure if something else needs to be done in case the key of a master record changes.
Is the child also inaccurately considered as fetched in that case?
I’ve updated fix a few posts above.
In case master key is changed, you need to manually update details table and replace old master key with new one in that records.