Skip to main content
Version: 11.2

$.udb(ds).refresh()

note

This article is about the refresh() function of the DataSourceContainer object.

$.udb(ds).refresh()

Refreshes the current data set. All other data sets of the data source become invalidated, and will be requeried when viewed again.

Any inserted (but not committed) records that are not re-queried in the current data set are made hidden and will re-appear when their appropriate data set is re-visited. Any gaps left by deleted (but not committed) records will be filled up.

Returns a UdbPromise object with the UdbDsc object as parameter.

Syntax

$.udb( *ds* ).refresh( *options* )
.then( ( *dsc* ) => {
// success
})
.catch(() => {
// failure
})
.finally(() => {
// executed after success / failure is handled
});

$.udb( *ds* ).rowSet( *rowSet*).refresh( *options* )
.then( ( *dsc* ) => {
// success
})
.catch(() => {
// failure
})
.finally(() => {
// executed after success / failure is handled
});

*options* ::= {
pKeys: *rowSet*,
[current]: *current*,
[condition]: *condition*
}

*current* ::= { true | [false] }
*condition* ::= { *column* : *search-condition*, ... }

The required ds is a data source selector.

The optional rowSet parameter is a rowset identifier. If the .rowSet() clause is omitted, then .rowSet('current') is assumed, unless the option pKeys specifies another one.

Options is a struct that can have the following items, all of which are optional.

Condition is a search condition that identifies the subset of rows that you want to be refreshed. See Example 2. The result of this "refresh" action is that the client will have the same records and the same values in these records as the server.

warning

This is not the same as refreshing a subset of rows already present on the client; use the .refresh() function of the UdbRows object for that.

If current is set to true, only the currently shown data set is refreshed. If it is set to false (the default), the entire data source is refreshed.

note

If the data source is not yet queried, then no data set gets requeried, because a refresh can only be done when there are already queried records. This is also the case if there are only newly inserted records; these records are left as they are.

Also: any hostvars supplied earlier, e.g. by a .executeQuery() call, are re-applied here with the refresh.

Example 1

//refresh the entire data source
$.udb('EMP').refresh();

Example 2

//refresh the records that match the condition only
$.udb('EMP').refresh({ condition: { BIRTHDAY: '>=01-JAN-1980' } });
EventApplies toOccurs when
beforerefreshData source objectsBefore a data source is refreshed.