# Keeping foundset from one form to another

**URL:** <https://forum.servoy.com/t/keeping-foundset-from-one-form-to-another/7628>\
**Category:** Classic Servoy\
**Created:** [June 7, 2007, 5:34pm UTC](https://forum.servoy.com/t/keeping-foundset-from-one-form-to-another/7628 "2007-06-07T17:34:29Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![elyod\_72](https://avatars.discourse-cdn.com/v4/letter/e/ed655f/32.png) [@elyod\_72](https://forum.servoy.com/u/elyod_72)\
**Post date:** [June 7, 2007, 5:34pm UTC](https://forum.servoy.com/t/keeping-foundset-from-one-form-to-another/7628/1 "2007-06-07T17:34:29Z")

</div>

I have two forms that see the same table and therefore basically see the same information. When I do a search and get a foundset in one form, I thought you could switch to the other form and the same foundset was kept since it is looking at the same table. Is that not correct? Is there something special I have to do to keep the foundset while switching from one form to another?

---

<div class="post-metadata">

**Author:** ![IT2Be](https://avatars.discourse-cdn.com/v4/letter/i/dc4da7/32.png) [@IT2Be](https://forum.servoy.com/u/IT2Be)\
**Post date:** [June 7, 2007, 5:48pm UTC](https://forum.servoy.com/t/keeping-foundset-from-one-form-to-another/7628/2 "2007-06-07T17:48:57Z")

</div>

Jim, You should check that ‘useSeperateFoundset’ is not checked but:

I always ‘move’ around foundsets with controller.loadRecords(foundset) to be in full control.

Maybe you have changed the foundset at one point and, after that, the ‘connection’ is lost.

---

<div class="post-metadata">

**Author:** ![sanneke](https://avatars.discourse-cdn.com/v4/letter/s/f9ae1b/32.png) [@sanneke](https://forum.servoy.com/u/sanneke)\
**Post date:** [June 8, 2007, 7:32am UTC](https://forum.servoy.com/t/keeping-foundset-from-one-form-to-another/7628/3 "2007-06-08T07:32:46Z")

</div>

Hi Jim,

Maybe you are looking at the first form through a relation, then the form also gets a separate foundset

---

<div class="post-metadata">

**Author:** ![elyod\_72](https://avatars.discourse-cdn.com/v4/letter/e/ed655f/32.png) [@elyod\_72](https://forum.servoy.com/u/elyod_72)\
**Post date:** [June 18, 2007, 5:55pm UTC](https://forum.servoy.com/t/keeping-foundset-from-one-form-to-another/7628/4 "2007-06-18T17:55:21Z")

</div>

I am still having problems with a founset not pulling thru from one form to the other. Here are the two methods I tried.

```auto
forms.ycm_coord.controller.showRecords(foundset);

```

and

```auto
forms.ycm_coord.controller.loadRecords(foundset);
forms.ycm_coord.controller.show();

```

Neither of these worked correctely. They both will give me all of the records and not just the found set.

---

<div class="post-metadata">

**Author:** ![IT2Be](https://avatars.discourse-cdn.com/v4/letter/i/dc4da7/32.png) [@IT2Be](https://forum.servoy.com/u/IT2Be)\
**Post date:** [June 18, 2007, 5:56pm UTC](https://forum.servoy.com/t/keeping-foundset-from-one-form-to-another/7628/5 "2007-06-18T17:56:43Z")

</div>

And you are sure they are based on the same server/table

---

<div class="post-metadata">

**Author:** ![elyod\_72](https://avatars.discourse-cdn.com/v4/letter/e/ed655f/32.png) [@elyod\_72](https://forum.servoy.com/u/elyod_72)\
**Post date:** [August 23, 2007, 6:51pm UTC](https://forum.servoy.com/t/keeping-foundset-from-one-form-to-another/7628/6 "2007-08-23T18:51:57Z")

</div>

Sorry, I have been away from this problem for quite a while.  
So to answer your question, yes the two forms in question both look to the same table.

If I view the two forms separately, and then run my script it works correctly. If I run it from the first form without viewing the second form ahead of time, it does not work.  
It’s like there is no connection between the two forms. Do I have to ‘touch’ both forms at the beginning of the session so that they are ‘connected’? That seem weird and would create unnecessary code.

---

<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:** [August 23, 2007, 8:03pm UTC](https://forum.servoy.com/t/keeping-foundset-from-one-form-to-another/7628/7 "2007-08-23T20:03:01Z")

</div>

If you take a foundset from a form and call controller.loadRecords(foundset) on the other form, this should always work. If you have a case where it does not, you should post that to the support system, I think.

---

<div class="post-metadata">

**Author:** ![elyod\_72](https://avatars.discourse-cdn.com/v4/letter/e/ed655f/32.png) [@elyod\_72](https://forum.servoy.com/u/elyod_72)\
**Post date:** [August 23, 2007, 9:36pm UTC](https://forum.servoy.com/t/keeping-foundset-from-one-form-to-another/7628/8 "2007-08-23T21:36:25Z")

</div>

So, you are saying it should work if I write it like this:

```auto
forms.layout2.controller.showRecords(forms.layout1.foundset);

```

Is this correct? Maybe I have the syntax wrong?

---

<div class="post-metadata">

**Author:** ![IT2Be](https://avatars.discourse-cdn.com/v4/letter/i/dc4da7/32.png) [@IT2Be](https://forum.servoy.com/u/IT2Be)\
**Post date:** [August 23, 2007, 9:39pm UTC](https://forum.servoy.com/t/keeping-foundset-from-one-form-to-another/7628/9 "2007-08-23T21:39:29Z")

</div>

That should work.

---

<div class="post-metadata">

**Author:** ![elyod\_72](https://avatars.discourse-cdn.com/v4/letter/e/ed655f/32.png) [@elyod\_72](https://forum.servoy.com/u/elyod_72)\
**Post date:** [August 29, 2007, 11:17pm UTC](https://forum.servoy.com/t/keeping-foundset-from-one-form-to-another/7628/10 "2007-08-29T23:17:30Z")

</div>

Unfortunately it did not work. The method is activated from a button on the form named ‘Coord\_Main’.

Below is my code:

```auto
var choose = plugins.dialogs.showSelectDialog( "Choose Report", "Please choose from the list of reports.", 'Shot Status', 'Extended One Liner', 'Shot Notes', 'Screening Log', 'Accounting One-Line', 'Finals List', 'Client List');
  switch( choose )
	{
	case 'Shot Status': forms.coord_shot_status.controller.showRecords(forms.Coord_Main.foundset); 
						break;
	case 'Extended One Liner': forms.coord_extended_one_liner.controller.showRecords(forms.Coord_Main.foundset); 
						break;
	case 'Shot Notes': forms.coord_shot_note.controller.showRecords(forms.Coord_Main.foundset); 
						break;
	case 'Screening Log': forms.coord_screening_log.controller.showRecords(forms.Coord_Main.foundset); 
						break;
	case 'Accounting One-Line': forms.coord_accounting_one_line.controller.showRecords(forms.Coord_Main.foundset); 
						break;
	case 'Finals List': forms.coord_finals_list.controller.showRecords(forms.Coord_Main.foundset); 
						break;
	case 'Client List': forms.full_shot_list.controller.showRecords(forms.Coord_Main.foundset); 
						break;
	default: break;
	}

```

When I run this method, it switches to the form called, but gives me all of the records.  
Is this a bug or am I doing something wrong?

---

<div class="post-metadata">

**Author:** ![IT2Be](https://avatars.discourse-cdn.com/v4/letter/i/dc4da7/32.png) [@IT2Be](https://forum.servoy.com/u/IT2Be)\
**Post date:** [August 30, 2007, 5:32am UTC](https://forum.servoy.com/t/keeping-foundset-from-one-form-to-another/7628/11 "2007-08-30T05:32:12Z")

</div>

You must be doing something wrong, loading the data in another way in another method maybe.  
I can not believe this is a bug, it is core functionality.

---

<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:** [August 30, 2007, 6:23am UTC](https://forum.servoy.com/t/keeping-foundset-from-one-form-to-another/7628/12 "2007-08-30T06:23:05Z")

</div>

What does the onShow method of the form you go to do? Couldn’t you just debug a bit and see what goes on in the debugger (for example by evaluating the foundset of the target form before and after and so forth)?

---

<div class="post-metadata">

**Author:** ![pbakker](https://avatars.discourse-cdn.com/v4/letter/p/a4c791/32.png) [@pbakker](https://forum.servoy.com/u/pbakker)\
**Post date:** [August 30, 2007, 7:11am UTC](https://forum.servoy.com/t/keeping-foundset-from-one-form-to-another/7628/13 "2007-08-30T07:11:28Z")

</div>

I’d check the onLoad and onShow of the form you’re displaying to see if you override the foundset in any way.

Paul

---

<div class="post-metadata">

**Author:** ![elyod\_72](https://avatars.discourse-cdn.com/v4/letter/e/ed655f/32.png) [@elyod\_72](https://forum.servoy.com/u/elyod_72)\
**Post date:** [August 30, 2007, 6:31pm UTC](https://forum.servoy.com/t/keeping-foundset-from-one-form-to-another/7628/14 "2007-08-30T18:31:20Z")

</div>

onShow is blank.  
onLoad has a method that it activates to only show “ACTIVE” records.

```auto
controller.addFoundSetFilterParam('status', '=', 'ACTIVE');
controller.loadRecords();

```

Both layouts have the exact same setup with the same method onLoad. and nothing in onShow.

That’s it.

I don’t understand. From the feedback I have recieved, my method should work.  
BTW, thanks guys for all of your great input.

So, any other ideas?

---

<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:** [August 30, 2007, 9:20pm UTC](https://forum.servoy.com/t/keeping-foundset-from-one-form-to-another/7628/15 "2007-08-30T21:20:38Z")

</div>

create a sample so we can look at it…
