# Help with 200 record limit

**URL:** <https://forum.servoy.com/t/help-with-200-record-limit/9570>\
**Category:** Classic Servoy\
**Created:** [September 11, 2008, 9:58am UTC](https://forum.servoy.com/t/help-with-200-record-limit/9570 "2008-09-11T09:58:31Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![tommygill](https://avatars.discourse-cdn.com/v4/letter/t/aeb1de/32.png) [@tommygill](https://forum.servoy.com/u/tommygill)\
**Post date:** [September 11, 2008, 9:58am UTC](https://forum.servoy.com/t/help-with-200-record-limit/9570/1 "2008-09-11T09:58:31Z")

</div>

Hi all

I know that this subject has been discussed before, but I still can’t get past the limit.

I have a calendar that shows reservations. One field of the reservation has a method attached that in theory should take me to a Edit Record Form, displaying the selected record. This works wonderfully if the record is within the first 200 Records. If it is not contained in the displayed 200 records, then the first record in the 200 group is displayed. This results is consistent whether I use a “Find & Search” function or a “Get dataset by Query” function.

I Know that I should be able to get to any record no matter where it resides, I just can’t seem to get it to work.

Any help would be appreciated.

Tom

---

<div class="post-metadata">

**Author:** ![Harjo](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/harjo/32/4873_2.png) [@Harjo](https://forum.servoy.com/u/Harjo)\
**Post date:** [September 11, 2008, 10:55am UTC](https://forum.servoy.com/t/help-with-200-record-limit/9570/2 "2008-09-11T10:55:08Z")

</div>

HI Tom,

you could do: forms.yourform.controller.showRecords(foundset)

that will bring your total foundset AND selectedIndex over to the other form.

---

<div class="post-metadata">

**Author:** ![tommygill](https://avatars.discourse-cdn.com/v4/letter/t/aeb1de/32.png) [@tommygill](https://forum.servoy.com/u/tommygill)\
**Post date:** [September 12, 2008, 10:17am UTC](https://forum.servoy.com/t/help-with-200-record-limit/9570/3 "2008-09-12T10:17:14Z")

</div>

Thanks Harjo

Sorry that it has taken so long to reply. You wrote,

> HI Tom,
> 
> you could do: forms.yourform.controller.showRecords(foundset)
> 
> that will bring your total foundset AND selectedIndex over to the other form.

Following is the code that I used.

```auto
if (resNum)
{
	var maxReturnedRows = -1;
	var query = "select reservation_id from reservations where reservation_number = '" + resNum + "'";
	var dataset = databaseManager.getDataSetByQuery(controller.getServerName(), query, null, maxReturnedRows);
	forms.Edit_Reservation.controller.showRecords(dateset)
}

```

There are 351 records in the table “reservations” If the “reservation\_number” that i am looking for is within the first two-hundred records everything works as desired. If the “reservation\_number” that i am looking for is not within the first two-hundred records it reverts to the first record of the two-hundred records. This behavior is consistent.

Any more insights will greatly appreciated.  
Tom

---

<div class="post-metadata">

**Author:** ![Harjo](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/harjo/32/4873_2.png) [@Harjo](https://forum.servoy.com/u/Harjo)\
**Post date:** [September 12, 2008, 11:07am UTC](https://forum.servoy.com/t/help-with-200-record-limit/9570/4 "2008-09-12T11:07:11Z")

</div>

Hi TOm,

if you do this: forms.Edit\_Reservation.controller.showRecords(dateset)

the foundset sharing between forms will be broken!

Why don’t you use a simple controller.find() and controller.search()  
that way the foundset is shared between all forms!

---

<div class="post-metadata">

**Author:** ![tommygill](https://avatars.discourse-cdn.com/v4/letter/t/aeb1de/32.png) [@tommygill](https://forum.servoy.com/u/tommygill)\
**Post date:** [September 12, 2008, 11:49am UTC](https://forum.servoy.com/t/help-with-200-record-limit/9570/5 "2008-09-12T11:49:05Z")

</div>

Harjo

Here is the modified Code

```auto
if (resNum)
{
	forms.Edit_Reservation.controller.find()
	forms.Edit_Reservation.reservation_number = resNum
	forms.Edit_Reservation.controller.search()

	forms.Edit_Reservation.controller.showRecords()
}

```

I still get the same results. If the record is within the first 200 records everything works fine. I the record is not within the first 200 records it reverts to the first record of the first 200 records.

Tom

---

<div class="post-metadata">

**Author:** ![Westy](https://avatars.discourse-cdn.com/v4/letter/w/9de053/32.png) [@Westy](https://forum.servoy.com/u/Westy)\
**Post date:** [September 12, 2008, 2:29pm UTC](https://forum.servoy.com/t/help-with-200-record-limit/9570/6 "2008-09-12T14:29:06Z")

</div>

After the search, try inserting:

```auto
for(var i=1; i<=foundset.getSize(); i++) 
{ 
    var record = foundset.getRecord(i); 
}

```

to pull down your entire found set.

Dean Westover  
Choices Software, inc.

---

<div class="post-metadata">

**Author:** ![jgarfield](https://avatars.discourse-cdn.com/v4/letter/j/7ea924/32.png) [@jgarfield](https://forum.servoy.com/u/jgarfield)\
**Post date:** [September 12, 2008, 4:04pm UTC](https://forum.servoy.com/t/help-with-200-record-limit/9570/7 "2008-09-12T16:04:38Z")

</div>

Alternatively you can try this which requires a little less looping

```auto
var nFSCount = databaseManager.getFoundSetCount(foundset)
while (foundset.getSize() < nFSCount)
{
	foundset.setSelectedIndex(forms[sForm].foundset.getSize());
}
foundset.setSelectedIndex(1);

```

---

<div class="post-metadata">

**Author:** ![tommygill](https://avatars.discourse-cdn.com/v4/letter/t/aeb1de/32.png) [@tommygill](https://forum.servoy.com/u/tommygill)\
**Post date:** [September 13, 2008, 9:29am UTC](https://forum.servoy.com/t/help-with-200-record-limit/9570/8 "2008-09-13T09:29:46Z")

</div>

Hi All

I am sorry that it takes me so long to respond. No excuse.

Thanks westy & garfield for you suggestions but they did not help and I think it is my fault.

More Details might help. I have a calendar showing reservations for multiple units. This calendar is based on the table “units” and uses calculation to connect reservations to units and displays this data both graphically and text. This calendar is a list view. Selecting the field which contains the “reservation\_number” triggers the method that is our focus. This method then finds the reservation record with that specific “reservation\_number” and shows the “Edit\_Reservation” form, displaying the correct reservation record. This works great as long as the found record is within the first 200 records. If it isn’t, the “Edit\_Reservation” form displays the first record of the first 200 record.

I am sorry but there just seems to be no way around this 200 record limit.

Tom

---

<div class="post-metadata">

**Author:** ![tommygill](https://avatars.discourse-cdn.com/v4/letter/t/aeb1de/32.png) [@tommygill](https://forum.servoy.com/u/tommygill)\
**Post date:** [September 15, 2008, 10:40am UTC](https://forum.servoy.com/t/help-with-200-record-limit/9570/9 "2008-09-15T10:40:13Z")

</div>

Hi all

What seems to be an unsolvable problem is really never unsolvable.

I found an erroneous “controler.loadAllRecords” cmd hidden in a method that was causing it to appear that the find command was not working. Removed the code and it all works fine. ![:D]( "Very Happy")

Thanks for all your assistance. It is greatly appreciated.

Tom

---

<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:** [September 15, 2008, 1:10pm UTC](https://forum.servoy.com/t/help-with-200-record-limit/9570/10 "2008-09-15T13:10:53Z")

</div>

> jgarfield:  
> Alternatively you can try this which requires a little less looping
> 
> ```auto
> var nFSCount = databaseManager.getFoundSetCount(foundset)
> 
> ```

while (foundset.getSize() \< nFSCount)  
{  
foundset.setSelectedIndex(forms[sForm].foundset.getSize());  
}  
foundset.setSelectedIndex(1);

> ```auto
> 
> ```

If you want even less looping, you can do this:

```auto
var nFSCount = databaseManager.getFoundSetCount(foundset);
foundset.getRecord(nFSCount);

```

Having said that, this is still a relatively expensive operation. If you users need to go to the last record often, you probably need some better ways to search or filter your records.

---

<div class="post-metadata">

**Author:** ![david](https://avatars.discourse-cdn.com/v4/letter/d/aeb1de/32.png) [@david](https://forum.servoy.com/u/david)\
**Post date:** [September 15, 2008, 3:34pm UTC](https://forum.servoy.com/t/help-with-200-record-limit/9570/11 "2008-09-15T15:34:06Z")

</div>

Your case is a common scenario in Servoy. Your edit form does not share the same foundset as the source form – because it is related to whatever calendar item you’re on. The main issue being that if the destination foundset doesn’t contain the source foundset record, you will not arrive on the source record on the destination form.

There are three recommended solutions:

**Solution #1: Search for the destination record**  
In the target form, search for the PK that you are looking for. A simple brute force approach that works every time. One potential downside is that you leave the user with no “context” – no records to browse that might be related to the destination record.

**Solution #2: Go through the destination foundset until you hit the record**  
If you want to keep the destination form’s foundset and arrive on the correct record, you need to loop through the foundset until you hit the record you want and then stop. The loop forces Servoy to load the next 200 records when it reaches the end of the currently loaded records in the foundset.

The upside to this approach is that you retain the destination form’s foundset. The downside is that if your record happens to be at the 30,000th record slot – you’ve just brought your solution to its knees for a bit of time. For this reason, this approach is not recommended except in very specific situations.

_ **This same warning applies to loading ALL of the destination forms records as outlined earlier in this thread! Not recommended unless you know what the implications are.** _

**Solution #3: Load the source foundset into the destination foundset**  
(Harjo alluded to this solution near the top.) A typical example of going to a related record is when you are viewing a list of child records on a parent record form and you want to go to the detail form for the child record.

The trick is to assign the destination form the same foundset as the source form:

forms.destination\_form\_name.controller.loadRecords(source\_form\_name.foundset)

The advantage to this technique is that you get a set of records at your destination which provides context for the record you navigated to. However, this context is supplied by the source form, not the destination form. This can be a disadvantage depending on what you are trying to achieve. A bonus to this technique is that you don’t have to do anything to navigate to the correct index. Forms that share the same foundset also share the same record index. If you started from index 3,054 you will arrive at index 3,054.

**Summary**  
Forms based on the same table typically share the same foundset and record index. In situations where they don’t share the same foundset, going to the same record in the destination form can be accomplished several different ways:

1. find the record directly
2. loop through the destination form’s foundset until you hit the record you want by PK
3. assign the source form foundset to the destination form

All three techniques have their advantages and disadvantages. The first technique is fool proof but provides no context (great for edit record situations!). The last technique provides context but not necessarily the context the user is expecting. With the second technique you get the expected context but performance is a significant disadvantage.

We usually default to the last technique but it is not always a clear cut choice.

We’ve been running into this confusion with new clients and developers for so many years we wrote this all up in a tip file a long time ago!
