Events

This page contains links to callbacks and the api available to Data Abstract client and server scripts.

Note that the value in the {}, after the function name & arguments, indentifies whether the function is available to server side scripts, globally, per command or table.


Functions

afterCommit() {Server, Global}

Called just after a transaction (set of insert/update/delete) has been committed.


afterGetData(names, requestInfos) {Server, Global & Per Table}

Called after a request for data is sent.

  • names will contain an array of table names
  • requestInfos is an array of the TableRequest objects.

afterExecuteCommand(sql, commandName, parameterNames, parameterValues, rowsAffected) {Server, Global & Per Command}

Called after an SQL command is executed.

  • sql contains the SQL to execute
  • commandName the name of the command
  • parameterNames is an array of parameter names
  • parameterValues is an array of object values
  • rowsAffected contains the number of rows affected by this command

afterLogin() {Relativity, Global}

Called after a user has logged in (for Relativity only).

Note: the afterLogin method is called only when the Relativity server uses a Login Provider.


afterProcessDelta(delta) {Server, Global & Per Table}

Called for each delta on the server after it is applied. Any changes to the delta will only be sent back to the client.

  • delta will be of Delta type.

afterProcessDeltaChange(delta, change, wasRefreshed) {Server, Global & Per Table}

Called after a change is applied to the database.

  • delta will be of Delta type
  • change will be of DeltaChange type.
  • wasRefreshed is true if the record was refreshed during processing delta change (it is actual if delta change contains Server Autorefresh fields), otherwise it is false

afterRollback() {Server, Global}

Called just after a transaction (set of insert/update/delete) is rolled back (canceled).


beforeCommit() {Server, Global}

Called just before a transaction (set of insert/update/delete) has been committed.


beforeDelete(row) {Server & Client, Per Table}

Called when the client (or server, depending on the schema settings) deletes a record. Call the global fail() method from here to stop the change from occurring.

  • row is an object implementing the IRowHelper interface. Client-side this will be the data row to be deleted, while server-side the method argument will be a corresponding DeltaChange Object.

beforeGetData(names, requestInfos) {Server, Global & Per Table}

Called before a request for data is sent.

  • names will contain an array of table names
  • requestInfos is an array of TableRequest objects.

beforeExecuteCommand(sql, commandName, parameterNames, parameterValues) {Server, Global & Per Command}

Called before an SQL command is executed.

  • sql contains the SQL to execute, commandName the name of the command.
  • parameterNames is an array of parameter names
  • parameterValues is an array of object values

beforeLogout() {Relativity, Global}

Called after a user has logged out (for Relativity only).

Note: the beforeLogout method is called only when the Relativity Server uses a Login Provider.


beforePost(row) {Server & Client, Per Table}

Called before a change to a record is accepted. Call the global fail() method from here to stop the change from occuring.

  • row is an object implementing the IRowHelper interface. Client-side this will be the data row to be changed, while server-side the method argument will be a corresponding DeltaChange Object.

beforeProcessDelta(delta) {Server, Global & Per Table}

Called for each delta on the server before it is applied. Any changes to the delta will be posted to the database.

  • delta will be of Delta type.

beforeProcessDeltaChange(delta, change, wasRefreshed, canRemove) {Server, Global & Per Table}

Called before a change is applied to the database. Any implementation should return the current value of canRemove unless it is changed.

  • delta will be of Delta type
  • change will be of DeltaChange
  • wasRefreshed contains true if the record was refreshed.
  • canRemove contains true if the record is currently allowed to be removed (if it is a delete).

beforeRollback() {Server, Global}

Called just before a transaction (set of insert/update/delete) is rolled back (canceled).


onCreateTransaction() {Server, Global}

Called when a new transaction is created to fetch or update records.


onNewRow(row) {Client, Per Table}

This function can be used to initialize a new records' default values.

  • row is an object that represents a new data row with the values that can be read or written to. Row values are accessible by index and by name.

onProcessError(delta, change, canContinue, error) {Server, Global & Per Table}

Called when an error occurs while applying a change. Should return the current value of canContinue, or false to stop trying the next change.

  • delta will be of Delta Object type.
  • change will be of DeltaChange Object type.
  • canContinue will be the current value of canContinue set by any previous events.
  • error contains the error message.

onUnknownSqlMacroIdentifier(name) {Server, Global}

Called when an unknown macro is used from within an SQL statement. Should return the new value.

  • name is a string containing the macro.

onValidateCommandAccess(name, parameterNames, parameterValues, currentlyAllowed) {Server, Global & Per Command}

Called before a command is executed; should return true if access is allowed.

  • name contains the command name.
  • parameterNames is an array of parameter names.
  • parameterValues is an array of object values.
  • currentlyAllowed will contain the information whether the data table is accessible according to the current rules.

onValidateDataTableAccess(name, parameterNames, parameterValues, currentAllowed) {Server, Global & Per Table}

Called during the validation of a request (fetching) for a data table. Should return true if access to that table should be allowed.

  • name is the data table name.
  • parameterNames is an array of parameter names.
  • parameterValues is an array of object values.
  • currentlyAllowed will contain the information whether the data table is accessible according to the current rules.

onValidateDirectSQLAccess(sql, parameterNames, parameterValues, currentAllowed) {Server, Global}

Called when a user executes raw SQL. Generally, this function is disabled but can be allowed by returning true here.

  • sql contains the raw SQL.
  • parameterNames is an array of parameter names.
  • parameterValues is an array of object values.
  • currentlyAllowed will contain the information whether the data table is accessible according to the current rules.