# foundset iterator

**URL:** <https://forum.servoy.com/t/foundset-iterator/18108>\
**Category:** Classic Servoy\
**Created:** [August 8, 2014, 6:11pm UTC](https://forum.servoy.com/t/foundset-iterator/18108 "2014-08-08T18:11:05Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![poyel](https://avatars.discourse-cdn.com/v4/letter/p/e79b87/32.png) [@poyel](https://forum.servoy.com/u/poyel)\
**Post date:** [August 8, 2014, 6:11pm UTC](https://forum.servoy.com/t/foundset-iterator/18108/1 "2014-08-08T18:11:05Z")

</div>

Hi,

foundest has a new iterator method for simply loop on record.  
I create a new table with two columns,

newTable  
tableId counter

and create two function

- populateTable
- editRecords

in populateTable i create, in a loop of 10000, the new records of table (total 30000 new records created in 1 minute and 30 seconds) .  
in editRecords i try the new iterator for edit all the records in table in ~3 minutes.

On previous version i’m wait 10 minutes for the same single operation.

Good work ![:wink:]( "Wink") ![:P]( "Razz")

---

<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 15, 2014, 1:22pm UTC](https://forum.servoy.com/t/foundset-iterator/18108/2 "2014-08-15T13:22:40Z")

</div>

Good that it works well for you. But this feature was already available in Servoy 7.4 ![:-)]( "Smile")

---

<div class="post-metadata">

**Author:** ![poyel](https://avatars.discourse-cdn.com/v4/letter/p/e79b87/32.png) [@poyel](https://forum.servoy.com/u/poyel)\
**Post date:** [August 16, 2014, 12:17am UTC](https://forum.servoy.com/t/foundset-iterator/18108/3 "2014-08-16T00:17:38Z")

</div>

Wow it’s fantastic.  
But when servoy 7.4 will released?

Bye Bye

---

<div class="post-metadata">

**Author:** ![mboegem](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/mboegem/32/4399_2.png) [@mboegem](https://forum.servoy.com/u/mboegem)\
**Post date:** [August 17, 2014, 11:12am UTC](https://forum.servoy.com/t/foundset-iterator/18108/4 "2014-08-17T11:12:54Z")

</div>

> poyel:  
> But when servoy 7.4 will released?

This should be rephrased to: when was 7.4 released ![;-)]( "Wink") (march 2014)

In the meantime 7.4.1 was released:  
[https://www.servoy.com/forum/viewtopic.php?f=16&t=20397](https://www.servoy.com/forum/viewtopic.php?f=16&t=20397)

For a complete overview of releases, you can keep an eye on this part of the forum:  
[https://www.servoy.com/forum/viewforum.php?f=16](https://www.servoy.com/forum/viewforum.php?f=16)

---

<div class="post-metadata">

**Author:** ![poyel](https://avatars.discourse-cdn.com/v4/letter/p/e79b87/32.png) [@poyel](https://forum.servoy.com/u/poyel)\
**Post date:** [August 17, 2014, 2:02pm UTC](https://forum.servoy.com/t/foundset-iterator/18108/5 "2014-08-17T14:02:20Z")

</div>

Oh i’m sorry ![:P]( "Razz")

i’m going in confusion with all this versions ![:P]( "Razz")

I’m waiting for the 7.4.2 ![:mrgreen:]( "Mr. Green")

---

<div class="post-metadata">

**Author:** ![juan.cristobo](https://avatars.discourse-cdn.com/v4/letter/j/df788c/32.png) [@juan.cristobo](https://forum.servoy.com/u/juan.cristobo)\
**Post date:** [February 3, 2015, 9:47am UTC](https://forum.servoy.com/t/foundset-iterator/18108/6 "2015-02-03T09:47:54Z")

</div>

Interesting… what’s that iterator method?

---

<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:** [February 3, 2015, 2:30pm UTC](https://forum.servoy.com/t/foundset-iterator/18108/7 "2015-02-03T14:30:35Z")

</div>

new features are not always good communicated! ![:cry:]( "Crying or Very sad") (also this one, was totally new for me)  
I also looked into the release notes, on this forum, but I can’t find any reference to this new iterator…

I googled the Servoy Wiki and found this:

[https://wiki.servoy.com/display/DOCS/Th … y+Foundset](https://wiki.servoy.com/display/DOCS/The+Servoy+Foundset)

---

<div class="post-metadata">

**Author:** ![poyel](https://avatars.discourse-cdn.com/v4/letter/p/e79b87/32.png) [@poyel](https://forum.servoy.com/u/poyel)\
**Post date:** [February 3, 2015, 2:45pm UTC](https://forum.servoy.com/t/foundset-iterator/18108/8 "2015-02-03T14:45:23Z")

</div>

The foundset iterator is like the iterator over the array.

You can call

```auto
foundset.loadAllRecords();
foundset.forEach(
           /**
             * @param {JSRecord} record
             * @param recordIndex
             * @param {JSFoundset} fs
             */
            function(record, recordIndex, fs) {
                application.output("record processed: " + record + ", record index: " + recordIndex);
            }
);

```

instedof

```auto
foundset.loadAllRecords();
for (var i = 1; i <= foundset.getSize(); i++) {
application.output("record processed: " + foundset.getRecord(i) + ", record index: " + i);
}

```

With this new features you are able to loop through the foundset’s record most rapidly.

I hope I was clear in explaining.

Bye Bye

---

<div class="post-metadata">

**Author:** ![juan.cristobo](https://avatars.discourse-cdn.com/v4/letter/j/df788c/32.png) [@juan.cristobo](https://forum.servoy.com/u/juan.cristobo)\
**Post date:** [February 3, 2015, 2:52pm UTC](https://forum.servoy.com/t/foundset-iterator/18108/9 "2015-02-03T14:52:17Z")

</div>

Awesome! Thanks, poyel

---

<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:** [February 3, 2015, 3:19pm UTC](https://forum.servoy.com/t/foundset-iterator/18108/10 "2015-02-03T15:19:44Z")

</div>

> poyel:  
> With this new features you are able to loop through the foundset’s record most rapidly.
> 
> I hope I was clear in explaining.
> 
> Bye Bye

the point I’m making is, that NOwhere is communicated that this features is 3 times faster. It only states that it is safer in certain circumstances.

---

<div class="post-metadata">

**Author:** ![jdbruijn](https://avatars.discourse-cdn.com/v4/letter/j/ed8c4c/32.png) [@jdbruijn](https://forum.servoy.com/u/jdbruijn)\
**Post date:** [February 3, 2015, 3:30pm UTC](https://forum.servoy.com/t/foundset-iterator/18108/11 "2015-02-03T15:30:54Z")

</div>

I hadn’t heard about that feature before.  
And I cannot find it in the Wiki at [JSFoundSet | Docs](https://wiki.servoy.com/display/DOCS/JSFoundSet)

---

<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:** [February 3, 2015, 3:50pm UTC](https://forum.servoy.com/t/foundset-iterator/18108/12 "2015-02-03T15:50:51Z")

</div>

yup, it’s hard to find

[https://wiki.servoy.com/display/DOCS/Th … y+Foundset](https://wiki.servoy.com/display/DOCS/The+Servoy+Foundset)

---

<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:** [February 3, 2015, 7:09pm UTC](https://forum.servoy.com/t/foundset-iterator/18108/13 "2015-02-03T19:09:50Z")

</div>

The iterator was not designed to be faster, just to be safer and I cannot think of why it would be faster (but good if it is for you).

In addition to the releasenotes on the forum (which is just a list of caseid’s with their topics), there was also always a “New in X.x” page posted in the wiki documentation for the specific version, which gave a more readable and most often also more detailed overview of each release. In this case: [https://wiki.servoy.com/display/Serv7/New+in+7.4](https://wiki.servoy.com/display/Serv7/New+in+7.4)

Paul

---

<div class="post-metadata">

**Author:** ![omar](https://avatars.discourse-cdn.com/v4/letter/o/f0a364/32.png) [@omar](https://forum.servoy.com/u/omar)\
**Post date:** [February 6, 2015, 3:26pm UTC](https://forum.servoy.com/t/foundset-iterator/18108/14 "2015-02-06T15:26:26Z")

</div>

It is currently missing in the JSFoundset API documentation.

---

<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:** [February 6, 2015, 9:59pm UTC](https://forum.servoy.com/t/foundset-iterator/18108/15 "2015-02-06T21:59:32Z")

</div>

Hi Paul, great to see you’re still around ![:D]( "Very Happy")

---

<div class="post-metadata">

**Author:** ![paronne](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/paronne/32/5096_2.png) [@paronne](https://forum.servoy.com/u/paronne)\
**Post date:** [March 19, 2015, 1:32pm UTC](https://forum.servoy.com/t/foundset-iterator/18108/16 "2015-03-19T13:32:28Z")

</div>

As Paul said, the iterator has not been implemented to loop faster on a foundset and based on my benchmarking actually is not.

Servoy 7.4.2 introduces performance improvments when looping on thousand of records, this is why, Marco, your execution time dropped from 10 minutes to 3 minutes.

Marco looping on a foundset with a normal loop on 7.4.2 should not be slower then the iterator, have you already made this kind of test ?
