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


Postby dekumar2 » Mon May 15, 2017 12:30 pm

Hi all, I want to change value of the data in foundset how can i change?
Posts: 8
Joined: Thu May 11, 2017 6:59 am

Re: Foundset

Postby ROCLASI » Mon May 15, 2017 12:32 pm


You can simply set the value like so:
Code: Select all
foundset.myColymnName = 'new value';

// making sure the data is saved to the database

Hope this helps.
Robert Ivens
ROCLASI Software Solutions / JBS Group, Partner
SAN Developer / Servoy Valued Professional / Servoy Certified Developer
Twitter: @roclasi / @servoyforge
ServoyForge - Building Open Source Software.
PostgreSQL - The world's most advanced open source database.
User avatar
Servoy Expert
Posts: 5243
Joined: Thu Oct 02, 2003 9:49 am
Location: Netherlands/Belgium

Re: Foundset

Postby Bernd.N » Mon May 15, 2017 4:08 pm

And in case you are in the js-script of a form and you want to change the current record of that form, you can omit "foundset." at the front.

saveData() is needed especially when you need to be sure that the data is saved at once, e.g. because something else depends on it at once.
Otherwise, Servoy will save it automatically later.

When you want to change all the data in a foundset and not only the current record, that's a complete other story.
You have to iterate over it, see for example

But not with forEach(), but with code like
Code: Select all

for( i=1; i <= foundset.getSize(); i++ ) {

   rec = foundset.getRecord(i);

   rec.fieldName = rec.fieldName + 'newValue';
Bernd Korthaus
Servoy 7.4.9 SC postgreSQL 9.4.11 Windows 10 Pro
User avatar
Posts: 486
Joined: Mon Oct 21, 2013 5:57 pm
Location: Langenhorn, North Friesland, Germany

Re: Foundset

Postby marco.rossi » Tue May 16, 2017 4:25 pm

Hi Dekumar,

you can also use a foundsetUpdater if you have to change data massively:

Code: Select all
var _updater = databaseManager.getFoundSetUpdater(foundsetToUpdate)

   if() {

Keep in mind that in this way you are changing all rows present within the foundset.
Marco Rossi
Senior Analyst Developer
Freelance Consultant

IT Manager @Mantho
Webmaster @Sitoliquido
Posts: 42
Joined: Sun Apr 12, 2015 9:33 pm

Return to Programming with Servoy

Who is online

Users browsing this forum: No registered users and 2 guests