# Editing master table after disablecontrols incorrectly marks the details as fetched

**URL:** https://talk.remobjects.com/t/editing-master-table-after-disablecontrols-incorrectly-marks-the-details-as-fetched/16398
**Category:** Data Abstract
**Tags:** delphi
**Created:** [May 17, 2018, 11:40am UTC](https://talk.remobjects.com/t/editing-master-table-after-disablecontrols-incorrectly-marks-the-details-as-fetched/16398 "2018-05-17T11:40:33Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![marcantheunis](https://talk.remobjects.com/letter_avatar_proxy/v4/letter/m/bcef8e/32.png) [@marcantheunis](https://talk.remobjects.com/u/marcantheunis)
#### Post date: [May 17, 2018, 11:40am UTC](https://talk.remobjects.com/t/editing-master-table-after-disablecontrols-incorrectly-marks-the-details-as-fetched/16398/1 "2018-05-17T11:40:33Z")

</div>

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

---

<div class="post-metadata">

### Author: ![EvgenyK](https://talk.remobjects.com/user_avatar/talk.remobjects.com/evgenyk/32/16_2.png) [@EvgenyK](https://talk.remobjects.com/u/EvgenyK)
#### Post date: [May 17, 2018, 11:45am UTC](https://talk.remobjects.com/t/editing-master-table-after-disablecontrols-incorrectly-marks-the-details-as-fetched/16398/2 "2018-05-17T11:45:54Z")

</div>

can you create a simple testcase that reproduced this case, pls?  
you can attach it here or send directly to support@

---

<div class="post-metadata">

### Author: ![marcantheunis](https://talk.remobjects.com/letter_avatar_proxy/v4/letter/m/bcef8e/32.png) [@marcantheunis](https://talk.remobjects.com/u/marcantheunis)
#### Post date: [May 17, 2018, 11:57am UTC](https://talk.remobjects.com/t/editing-master-table-after-disablecontrols-incorrectly-marks-the-details-as-fetched/16398/3 "2018-05-17T11:57:42Z")

</div>

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-

---

<div class="post-metadata">

### Author: ![RemObjectsSoftware](https://talk.remobjects.com/user_avatar/talk.remobjects.com/remobjectssoftware/32/15947_2.png) [@RemObjectsSoftware](https://talk.remobjects.com/u/RemObjectsSoftware)
#### Post date: [May 18, 2018, 10:57am UTC](https://talk.remobjects.com/t/editing-master-table-after-disablecontrols-incorrectly-marks-the-details-as-fetched/16398/4 "2018-05-18T10:57:26Z")

</div>

Thanks, logged as bugs://80190

---

<div class="post-metadata">

### Author: ![RemObjectsSoftware](https://talk.remobjects.com/user_avatar/talk.remobjects.com/remobjectssoftware/32/15947_2.png) [@RemObjectsSoftware](https://talk.remobjects.com/u/RemObjectsSoftware)
#### Post date: [May 18, 2018, 11:01am UTC](https://talk.remobjects.com/t/editing-master-table-after-disablecontrols-incorrectly-marks-the-details-as-fetched/16398/5 "2018-05-18T11:01:43Z")

</div>

bugs://80190 got closed with status fixed.

---

<div class="post-metadata">

### Author: ![EvgenyK](https://talk.remobjects.com/user_avatar/talk.remobjects.com/evgenyk/32/16_2.png) [@EvgenyK](https://talk.remobjects.com/u/EvgenyK)
#### Post date: [May 18, 2018, 11:02am UTC](https://talk.remobjects.com/t/editing-master-table-after-disablecontrols-incorrectly-marks-the-details-as-fetched/16398/6 "2018-05-18T11:02:34Z")

</div>

updated fix:

```auto
procedure TDADataTable.InternalBeforePost_DoEdit;
...
    if dt.Active and (dt.fOldMasterKey <> nil) 
    and (dt.fFetchedMasters.IndexOf(dt.fOldMasterKey)<>-1) //this line was added
    then 

```

---

<div class="post-metadata">

### Author: ![marcantheunis](https://talk.remobjects.com/letter_avatar_proxy/v4/letter/m/bcef8e/32.png) [@marcantheunis](https://talk.remobjects.com/u/marcantheunis)
#### Post date: [May 19, 2018, 8:15am UTC](https://talk.remobjects.com/t/editing-master-table-after-disablecontrols-incorrectly-marks-the-details-as-fetched/16398/7 "2018-05-19T08:15:32Z")

</div>

Thanks for the fast support.

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?

---

<div class="post-metadata">

### Author: ![RemObjectsSoftware](https://talk.remobjects.com/user_avatar/talk.remobjects.com/remobjectssoftware/32/15947_2.png) [@RemObjectsSoftware](https://talk.remobjects.com/u/RemObjectsSoftware)
#### Post date: [May 21, 2018, 1:14pm UTC](https://talk.remobjects.com/t/editing-master-table-after-disablecontrols-incorrectly-marks-the-details-as-fetched/16398/8 "2018-05-21T13:14:04Z")

</div>

bugs://80190 got reopened.

---

<div class="post-metadata">

### Author: ![EvgenyK](https://talk.remobjects.com/user_avatar/talk.remobjects.com/evgenyk/32/16_2.png) [@EvgenyK](https://talk.remobjects.com/u/EvgenyK)
#### Post date: [June 1, 2018, 12:06pm UTC](https://talk.remobjects.com/t/editing-master-table-after-disablecontrols-incorrectly-marks-the-details-as-fetched/16398/9 "2018-06-01T12:06:30Z")

</div>

> [@marcantheunis](#):
>
> 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.

---

<div class="post-metadata">

### Author: ![RemObjectsSoftware](https://talk.remobjects.com/user_avatar/talk.remobjects.com/remobjectssoftware/32/15947_2.png) [@RemObjectsSoftware](https://talk.remobjects.com/u/RemObjectsSoftware)
#### Post date: [June 1, 2018, 12:06pm UTC](https://talk.remobjects.com/t/editing-master-table-after-disablecontrols-incorrectly-marks-the-details-as-fetched/16398/10 "2018-06-01T12:06:40Z")

</div>

bugs://80190 got closed with status fixed.
