Have you ever came across in a situation, where you need to update a column for all records in the foundset? Like for an example, you need to modify the current date time stamp of ‘modified_on’ column for all the records in the foundset.
To achieve the same, you will update the column for all the records by using a for loop. Here, is a nice and quicker solution.
In these situations, Servoy’s foundset updater helps you a lot. You can update a column for all the records in the foundset in a single shot, without writing the for loop. It also works comparatively quicker than writing for loop, as it generates a single SQL UPDATE statement and executes the same.
In the below example, we will update the ‘is_archived’ column to ‘1’ for all the records present in the foundset.
// get the foundset updater object
var updater = databaseManager.getFoundSetUpdater(foundset);
// set the column value
// update in all the records in the foundset
The foundset updater can be used for updating multiple number of columns at a time. For the same, you need to add another setColumn() statement specifying the column to be updated.