JSFoundSetUpdater
Last updated
Last updated
JSFoundSetUpdater is a utility class designed to perform efficient updates on a foundset, enabling streamlined data modification in applications. By leveraging its methods, developers can iterate through records, assign new values to specific columns, and apply updates either to the entire foundset or selected subsets of records. This tool enhances performance by minimizing database interaction overhead and allowing bulk updates directly in the database when possible.
The updater supports three primary use cases:
Applying a single SQL statement to update all records in the foundset.
Updating specific records within the foundset.
Iterating safely through records to apply custom logic.
It ensures precise control over data changes while bypassing triggers like table events or modification column updates for direct database operations. With features like resettable iterators and support for both individual and batch updates, JSFoundSetUpdater offers a flexible and powerful approach to managing foundset modifications.
Type | Name | Summary |
---|---|---|
Go to next record in this updater, returns true if successful. NOTE: this method doesn't take into account deletes and inserts that may happen at same time. For more reliable iterator see foundset.forEach
Returns: Boolean true if proceeded to next record, false otherwise
Sample
Do the actual update in the database, returns true if successful. It will first try to save all editing records (from all foundsets), if cannot save will return false before doing the update. There are 3 types of possible use with the foundset updater 1) update entire foundset by a single sql statement; that is not possible when the table of the foundset has tracking enabled then it will loop over the whole foundset. When a single sql statement is done, modification columns will not be updated and associated Table Events won't be triggered, because it does the update directly in the database, without getting the records. NOTE: this mode will refresh all foundsets based on same datasource 2) update part of foundset, for example the first 4 row (starts with selected row) 3) safely loop through foundset (starts with selected row)
after the perform update call there are no records in edit mode, that where not already in edit mode, because all of them are saved directly to the database, or in mode 1 the records are not touched at all and the database is updated directly.
Returns: Boolean true if succeeded, false if failed.
Sample
Start over with this iterator 'next' function (at the foundset selected record).
Returns: void
Sample
Set the column value to update, returns true if successful.
Parameters
String name The name of the column to update.
Object value The new value (can be an array with data for x number of rows) to be stored in the specified column.
Returns: Boolean true if succeeded, false if failed.
Sample
Go to next record in this updater, returns true if successful.
Do the actual update in the database, returns true if successful.
void
Start over with this iterator 'next' function (at the foundset selected record).
Set the column value to update, returns true if successful.