Skip to main content
Version: 11.2

Rows.values()

note

This article is about the values() function of the Rows object.

Rows.values()

Sets one or more values on all rows in scope.

tip

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(() => {
// ...
});
EventApplies toOccurs when
colpostupdateData source objectsAfter a value in a record is updated
colpreupdateData source objectsBefore a value in a column is updated
rowpostupdateData source objectsAfter a record is updated
rowpreupdateData source objectsBefore a record is updated
note

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.