# Synchronise foundset between forms - again

**URL:** <https://forum.servoy.com/t/synchronise-foundset-between-forms-again/10951>\
**Category:** Classic Servoy\
**Created:** [July 23, 2009, 12:49pm UTC](https://forum.servoy.com/t/synchronise-foundset-between-forms-again/10951 "2009-07-23T12:49:25Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Harry\_Catharell](https://avatars.discourse-cdn.com/v4/letter/h/e19adc/32.png) [@Harry\_Catharell](https://forum.servoy.com/u/Harry_Catharell)\
**Post date:** [July 23, 2009, 12:49pm UTC](https://forum.servoy.com/t/synchronise-foundset-between-forms-again/10951/1 "2009-07-23T12:49:25Z")

</div>

Servoy Developer  
Version 3.5.10-build 524  
Java version 1.5.0\_19-137 (Mac OS X)

Hi all,

I have two forms based on same table and using same foundset: ‘tableA\_form’ & ‘tableA\_list’

At some point a user will be on a form from a different table: ‘tableB\_form’ which will be a child record of tableA  
On the tableB\_form is a button which takes the user back to the parent record using a child-parent relation:

```auto
forms.tableA_form.controller.showRecords(tableB_to_tableA);

```

This effectively separates the foundsets between ‘tableA\_form’ & ‘tableA\_list’

What is my best way to synchronise the foundset between these two forms again ?

Cheers  
Harry

---

<div class="post-metadata">

**Author:** ![patrick](https://avatars.discourse-cdn.com/v4/letter/p/b2d939/32.png) [@patrick](https://forum.servoy.com/u/patrick)\
**Post date:** [July 23, 2009, 1:13pm UTC](https://forum.servoy.com/t/synchronise-foundset-between-forms-again/10951/2 "2009-07-23T13:13:40Z")

</div>

I think what should do is

forms.tableA\_form.controller.loadRecords(foundset)

while this is called from tableA\_list

---

<div class="post-metadata">

**Author:** ![ROCLASI](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/roclasi/32/4371_2.png) [@ROCLASI](https://forum.servoy.com/u/ROCLASI)\
**Post date:** [July 23, 2009, 1:14pm UTC](https://forum.servoy.com/t/synchronise-foundset-between-forms-again/10951/3 "2009-07-23T13:14:59Z")

</div>

Hi Harry,

If memory serves me right then a controller.loadAllRecords() will relink the (shared) foundsets.  
When unlinked then you need to do all the syncing yourself (in your code).

Hope this helps.

---

<div class="post-metadata">

**Author:** ![ROCLASI](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/roclasi/32/4371_2.png) [@ROCLASI](https://forum.servoy.com/u/ROCLASI)\
**Post date:** [July 23, 2009, 1:16pm UTC](https://forum.servoy.com/t/synchronise-foundset-between-forms-again/10951/4 "2009-07-23T13:16:34Z")

</div>

> patrick:  
> I think what should do is
> 
> forms.tableA\_form.controller.loadRecords(foundset)
> 
> while this is called from tableA\_list

This does indeed load the foundset into the other form but doesn’t relink them. So even selecting another record won’t show through into the other form.

---

<div class="post-metadata">

**Author:** ![Harry\_Catharell](https://avatars.discourse-cdn.com/v4/letter/h/e19adc/32.png) [@Harry\_Catharell](https://forum.servoy.com/u/Harry_Catharell)\
**Post date:** [July 23, 2009, 2:26pm UTC](https://forum.servoy.com/t/synchronise-foundset-between-forms-again/10951/5 "2009-07-23T14:26:54Z")

</div>

Thanks for the input guys,

So, given that I do not want to load all records in that particular table in the short term whilst the user is managing records, would I be better off changing my code from being a show records via the relation from tableB to performing a find in tableA based on the parent pk ?  
This then may cut out the foundset management between the different views on any table never mind tableA

Cheers  
Harry

---

<div class="post-metadata">

**Author:** ![ROCLASI](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/roclasi/32/4371_2.png) [@ROCLASI](https://forum.servoy.com/u/ROCLASI)\
**Post date:** [July 23, 2009, 2:43pm UTC](https://forum.servoy.com/t/synchronise-foundset-between-forms-again/10951/6 "2009-07-23T14:43:55Z")

</div>

Hi Harry,

If you don’t want to manage the 2 foundsets yourself then I think searching will be the best way.

---

<div class="post-metadata">

**Author:** ![jcompagner](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/jcompagner/32/4889_2.png) [@jcompagner](https://forum.servoy.com/u/jcompagner)\
**Post date:** [July 23, 2009, 3:11pm UTC](https://forum.servoy.com/t/synchronise-foundset-between-forms-again/10951/7 "2009-07-23T15:11:02Z")

</div>

> ROCLASI:
> 
> > patrick:  
> > I think what should do is
> > 
> > forms.tableA\_form.controller.loadRecords(foundset)
> > 
> > while this is called from tableA\_list
> 
> This does indeed load the foundset into the other form but doesn’t relink them. So even selecting another record won’t show through into the other form.

this should work fine.

that way tableA will have the same foundset of tableA\_list and when you change selection in one or the other both will follow.

But another way to avoid this completely  
is to not use the same form as a main form and a tab or child panel.

When you do

forms.tableA\_form.controller.showRecords(tableB\_to\_tableA);

make another instance of that tableA\_form and let that show the relation.

---

<div class="post-metadata">

**Author:** ![Harry\_Catharell](https://avatars.discourse-cdn.com/v4/letter/h/e19adc/32.png) [@Harry\_Catharell](https://forum.servoy.com/u/Harry_Catharell)\
**Post date:** [July 23, 2009, 9:40pm UTC](https://forum.servoy.com/t/synchronise-foundset-between-forms-again/10951/8 "2009-07-23T21:40:33Z")

</div>

I think that here, because of the circumstances and the way that the user needs to work between form and list views, I will use a find/search to isolate the record and maintain the foundset link between forms.

The user workflow is well established and it will be less overhead in keeping the forms in sync

Thanks you all for the replies

Cheers  
Harry

---

<div class="post-metadata">

**Author:** ![bobbydtma](https://avatars.discourse-cdn.com/v4/letter/b/dbc845/32.png) [@bobbydtma](https://forum.servoy.com/u/bobbydtma)\
**Post date:** [July 23, 2009, 9:43pm UTC](https://forum.servoy.com/t/synchronise-foundset-between-forms-again/10951/9 "2009-07-23T21:43:31Z")

</div>

We are having exactly the same issue. We use the loadRecords() and then a custom query to load a foundet. We have other forms that we would like to share that custom foundset rather than running the query again for each additional form and then manually keeping track of what row is selected between the various forms, etc. Will there be a way in future releases to link forms with separate foundsets to the same foundset?

The reason we are having this issue is we have table forms and then separate solution model forms below the table holding a table count (aggregate) field. So far this method has worked as expected with the related and standard foundsets, but does not work with tables using loadRecords().

---

<div class="post-metadata">

**Author:** ![jcompagner](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/jcompagner/32/4889_2.png) [@jcompagner](https://forum.servoy.com/u/jcompagner)\
**Post date:** [July 24, 2009, 10:04am UTC](https://forum.servoy.com/t/synchronise-foundset-between-forms-again/10951/10 "2009-07-24T10:04:46Z")

</div>

if you want to have a form linked to the same foundset  
then when you do stuff with 1 of the forms. you have to set it also on the other .

If 1 form is on a tab of the other… And you just want to have those 2 (parent\<-\>child) always the same foundset.  
we have support for that. make a Self relation  
Thats a relation with the same datasource (server/table) on both size and no keys.

Then place the tab on the parent form with that relation. And then those 2 forms will always be in sync.
