$.udb.checkData()
This article is about the checkData() function of the $.udb object.
$.udb.checkData()
Checks all data manipulations against the database that are currently not yet checked in the current context.
Returns a UdbPromise object.
Syntax
$.udb.checkData( [options] )
.then(() => {
// success
})
.catch(() => {
// failure
})
.finally(() => {
// executed after success / failure is handled
});
*options* ::= {
[quiet]: *quiet*,
[waitState]: *wait-state*,
[precommit]: *precommit*
}
*quiet* ::= { true | [false] }
*wait-state* ::= { true | [false] }
*precommit* ::= { true | [false] }
Options is an optional struct that can have the following items, all of which are optional.
Quiet is a boolean that determines whether or not a message is displayed when an error occurs. The default is false, meaning that a message is displayed by default.
Wait-state automatically adds a loading icon to the application window while this function is being executed. This is especially useful if the server needs an unusually long time to complete. Its default value is false.
Precommit performs a pre-commit query automatically after all manipulations have been successfully executed, to determine if these queries are also committable. In that case, these manipulations are then flagged as 'checked', which means that if the data source is re-queried, these manipulations do not get rolled back automatically. The default value is false, which means that this pre-commit query is not automatically performed, and this flag is not set.
With the mentioned 'current context' we mean the frame context from which the call is made, i.e. in a typical default publication this usually is from a page with the 'ApplicationFrame' context.
If you want to perform it on a different frame context than from which your script is executed please use:
$.udb.context( *frame-context* ).execute(
() => $.udb.checkData( options )
);
or directly from the UdbContext object:
$.udb.context( *frame-context* ).checkData( options );
See the UdbContext object for more information.
If you have multiple frame contexts with manipulations pending and perform $.udb.checkData() without an active context, then the function gets executed for every of these contexts. This might result in multiple 'check succeeded' messages getting displayed.
In that case, please use the quiet option with its value set to true.
Examples
$.udb.checkData({ quiet: true });
$.udb.checkData({ precommit: true, quiet: true })
.then(() => {
alert('All manipulations are correct.');
});
Related events
| Event | Applies to | Occurs when |
|---|---|---|
| beforecheckdata | Page objects | Before each data check action |