# Related data from form not refreshing after query

**URL:** <https://forum.servoy.com/t/related-data-from-form-not-refreshing-after-query/20536>\
**Category:** Questions\
**Created:** [July 5, 2021, 7:33am UTC](https://forum.servoy.com/t/related-data-from-form-not-refreshing-after-query/20536 "2021-07-05T07:33:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![roddy](https://avatars.discourse-cdn.com/v4/letter/r/a5b964/32.png) [@roddy](https://forum.servoy.com/u/roddy)\
**Post date:** [July 5, 2021, 7:33am UTC](https://forum.servoy.com/t/related-data-from-form-not-refreshing-after-query/20536/1 "2021-07-05T07:33:12Z")

</div>

Hi,

I have a form with a superset of data in its foundset and a subform using a relationship to display a subset of the data in a tab panel. When I run a query against the superset foundset, no matter what I try, the subset will not update.

What I think should work is:

```auto
forms.main_form.foundset.loadRecords(sql, args);
foundsetToUpdate = forms[tabFormName][subFormElements.getTabRelationNameAt(tabIndex)];
foundsetToUpdate.loadRecords();

```

The foundsetToUpdate code is definitely returning the correct relationship foundset. Even if I call the subform directly with a loadRecords() then the foundset from the superset is not reflected in the subset, nothing changes. I have output the size of the superset to confirm it is being correctly updated by the sql.

I cannot loadRecords() directly into a related foundset, which is fine, though this is only fine if the relationship data can be updated ![:)]( "Smile")

Any help on this would be much appreciated.

---

<div class="post-metadata">

**Author:** ![Joas](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/joas/32/5095_2.png) [@Joas](https://forum.servoy.com/u/Joas)\
**Post date:** [July 5, 2021, 9:13am UTC](https://forum.servoy.com/t/related-data-from-form-not-refreshing-after-query/20536/2 "2021-07-05T09:13:54Z")

</div>

It shouldn’t be necessary to call loadRecords on the related foundset, it should load the related data automatically.

Try calling **databaseManager.getSQL(foundsetToUpdate)** (and **databaseManager.getSQLParameters(foundsetToUpdate)**) and check if the returned query is what you expect.

---

<div class="post-metadata">

**Author:** ![roddy](https://avatars.discourse-cdn.com/v4/letter/r/a5b964/32.png) [@roddy](https://forum.servoy.com/u/roddy)\
**Post date:** [July 5, 2021, 11:16pm UTC](https://forum.servoy.com/t/related-data-from-form-not-refreshing-after-query/20536/3 "2021-07-05T23:16:37Z")

</div>

Hi,

Thanks for the response; I totally agree about not needing too ![:-D]( "Very Happy"). I spent way too long on it so am going to take a different approach; I’ll check the SQL though I am thinking it might be because I am using a loadRecords() from an SQL on the superset and not using a find()/search().
