Page 1 of 1

Related data from form not refreshing after query

PostPosted: Mon Jul 05, 2021 9:33 am
by roddy
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:
Code: Select all
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 :)

Any help on this would be much appreciated.

Re: Related data from form not refreshing after query

PostPosted: Mon Jul 05, 2021 11:13 am
by Joas
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.

Re: Related data from form not refreshing after query

PostPosted: Tue Jul 06, 2021 1:16 am
by roddy
Hi,

Thanks for the response; I totally agree about not needing too :-D. 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().