Related data from form not refreshing after query

Questions and answers on designing your Servoy solutions, database modelling and other 'how do I do this' that don't fit in any of the other categories

Related data from form not refreshing after query

Postby roddy » Mon Jul 05, 2021 9:33 am

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.
roddy
 
Posts: 100
Joined: Mon Oct 26, 2020 12:32 am

Re: Related data from form not refreshing after query

Postby Joas » Mon Jul 05, 2021 11:13 am

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.
Joas de Haan
Yield Software Development
Need help on your project? yieldsd.com
User avatar
Joas
Site Admin
 
Posts: 842
Joined: Mon Mar 20, 2006 4:07 pm
Location: Leusden, NL

Re: Related data from form not refreshing after query

Postby roddy » Tue Jul 06, 2021 1:16 am

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().
roddy
 
Posts: 100
Joined: Mon Oct 26, 2020 12:32 am


Return to Programming with Servoy

Who is online

Users browsing this forum: No registered users and 10 guests