DeltaChange Object
The DeltaChange object is used to hold information about a single delta change. The DeltaChange object is returned by the Delta object from the default indexer and the nextRow()
and addChange()
functions.
The code snippet below shows how a DeltaChange object can be used:
function beforeProcessDeltaChange(delta, deltachange, wasRefreshed, canRemove)
{
var exp = /[A-Za-z]/;
if ( (!exp.test(deltachange['Name'])) && !deltachange.isDelete )
{
fail('Field "Name" should contain literal characters.');
}
if (deltachange.isInsert == false)
{
log('Change Name old value: '+ deltachange.oldValues['Name']);
log('Change Name new value: '+ deltachange.newValues['Name']);
}
}
Properties
isInsert
Returns true if this change represents a new record being added to the table. Otherwise returns false.
isUpdate
Returns true if this change represents an update to an existing record. Otherwise returns false.
isDelete
Returns true if this change represents the deletion of an existing record. Otherwise returns false.
failed
Returns true if this change already failed (on the server). Otherwise returns false.
error
Represents an error message for this delta change (on the server).
table
Reference to the Delta Object this delta change belongs to (not available on the client).
changeID
Returns the (negative) change number for this change.
count
Returns the number of fields in this delta change.
Functions
[]
The indexer provides access to new values for insert & update operations, for delete operations an exception will be thrown.
originalRow[]
Provides access to the original row for this delta. This is the row as stored in the database.
Note that accessing this indexer will incur extra cost on first access, as the row values need to be retrieved from the database.
finalRow[]
Provides access to the full row merged with the newValues. In essence, it provides a preview of what the row will look like in the database, if the change were to be applied successfully.
Note that accessing this indexer will incur extra cost on first access, as the row values need to be retrieved from the database.
discard()
Discards the changes in this object. After calling, the object isn't valid anymore.
oldValues[]
Indexer that provides access to the old values in this change. This indexer is not accessible for delete changes.
newValues[]
Indexer that provides access to the new values in this change. This indexer is not accessible for delete changes.