# Foundset

**URL:** <https://forum.servoy.com/t/foundset/19252>\
**Category:** Classic Servoy\
**Created:** [May 15, 2017, 10:30am UTC](https://forum.servoy.com/t/foundset/19252 "2017-05-15T10:30:17Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![dekumar2](https://avatars.discourse-cdn.com/v4/letter/d/49beb7/32.png) [@dekumar2](https://forum.servoy.com/u/dekumar2)\
**Post date:** [May 15, 2017, 10:30am UTC](https://forum.servoy.com/t/foundset/19252/1 "2017-05-15T10:30:17Z")

</div>

Hi all, I want to change value of the data in foundset how can i change?

---

<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:** [May 15, 2017, 10:32am UTC](https://forum.servoy.com/t/foundset/19252/2 "2017-05-15T10:32:42Z")

</div>

Hi,

You can simply set the value like so:

```auto
foundset.myColymnName = 'new value';

// making sure the data is saved to the database
databaseManager.saveData(foundset);

```

Hope this helps.

---

<div class="post-metadata">

**Author:** ![Bernd.N](https://avatars.discourse-cdn.com/v4/letter/b/7feea3/32.png) [@Bernd.N](https://forum.servoy.com/u/Bernd.N)\
**Post date:** [May 15, 2017, 2:08pm UTC](https://forum.servoy.com/t/foundset/19252/3 "2017-05-15T14:08:56Z")

</div>

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  
[https://wiki.servoy.com/display/public/DOCS/The+Servoy+Foundset#TheServoyFoundset-UsingtheFoundsetIterator](https://wiki.servoy.com/display/public/DOCS/The+Servoy+Foundset#TheServoyFoundset-UsingtheFoundsetIterator)

But not with forEach(), but with code like

```auto
var
   i=0,
   rec=null;

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

   rec = foundset.getRecord(i);

   rec.fieldName = rec.fieldName + 'newValue';
}

```

---

<div class="post-metadata">

**Author:** ![marco.rossi](https://avatars.discourse-cdn.com/v4/letter/m/58f4c7/32.png) [@marco.rossi](https://forum.servoy.com/u/marco.rossi)\
**Post date:** [May 16, 2017, 2:25pm UTC](https://forum.servoy.com/t/foundset/19252/4 "2017-05-16T14:25:26Z")

</div>

Hi Dekumar,

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

```auto
var _updater = databaseManager.getFoundSetUpdater(foundsetToUpdate)

	if() {
		_updater.setColumn("your_column",1)
	}else{
                _updater.setColumn("your_column",0)
        }
_updater.performUpdate()

```

Keep in mind that in this way you are changing all rows present within the foundset.
