Rows.values()
This article is about the values() function of the Rows object.
Rows.values()
Sets one or more values on all rows in scope.
To address a specific value in a specific row, use Cols.val() instead.
Returns a UdbPromise object with the UdbRows object as parameter.
Syntax
$.udb( *ds* ).rows( [rowRef1], [rowRef2] ).values( *values* )
.then( ( *rows* ) => {
// success
});
$.udb( *ds* ).rowSet( *rowSet* ).rows( [rowRef1], [rowRef2] ).values( *values* )
.then( ( *rows* ) => {
// success
});
The required ds parameter is a data source selector.
The optional rowSet parameter is a rowset identifier. If the .rowSet() clause is omitted, then .rowSet('current') is assumed.
The optional rowRef1, rowRef2 are row selectors. If omitted, all records in scope are addressed.
The required values is an object that specifies values for one or more columns of the row(s) in scope.
To consult before the update takes place, or to react after it completes, use the rowpreupdate/rowpostupdate (record-level) and colpreupdate/colpostupdate (column-level) events listed below, rather than a callback option.
Example
$.udb('EMP').rows('current').values({ NAME: 'JOHNSON', FIRST_NAME: 'PAUL' })
.then(() => {
// ...
});
Related events
| Event | Applies to | Occurs when |
|---|---|---|
| colpostupdate | Data source objects | After a value in a record is updated |
| colpreupdate | Data source objects | Before a value in a column is updated |
| rowpostupdate | Data source objects | After a record is updated |
| rowpreupdate | Data source objects | Before a record is updated |
Internally, .values() updates the row(s) via the same updateMultiple() mechanism that underlies value assignment elsewhere in UDB: it triggers rowpreupdate once per row before any column is set, then rowpostupdate once per row afterwards, and it also writes each individual column value, which fires colpreupdate/colpostupdate for every column actually changed.