Rolls a transaction back to its beginning.
|
Syntax:
|
Rollback(logical, generation)
|
Parameters:
|
logical: True or False. If True, Magic xpa will produce a popup Abort Transaction? box asking for user confirmation. If False, no confirmation will be requested.
|
|
generation: A number representing the transaction level, as listed below.
0 Rolls back to the root transaction level. 1 Rolls back to the current transaction level. 2 Rolls back to the parent transaction level.
|
Returns:
|
Logical True if transaction was rolled back, False if transaction was not aborted.
|
Example:
|
Rollback('TRUE'LOG,0)
|
Note:
|
While "transaction rollback" is generally thought of in terms of database failures and/or system crashes, it can also be usefully employed to handle exceptional situations related to application logic. Perhaps a batch program is processing financial transactions that update account balances in master records, and as a result of reading the current transaction record, a master record balance with a normal range of $5,000 to $100,000 suddenly exceeds $10,000,000. It may be necessary or desirable to not include this transaction in either the master account record or in related totals. This can easily be achieved through the use of the Rollback function in an Evaluate Expression operation with a condition checking the balance.
|
Relevant interfaces:
|
In Rich Client tasks, only Rollback(FALSE'LOG,1) is supported; other values will be regarded as 'FALSE'LOG and 1.
This function is:
-
Neutral for Rich Client tasks (Since version: 2.4). This is because the function needs to access the client in order to roll back local data sources and access the server in order to roll back server data sources.
-
Server-side for Browser tasks.
|
See also:
|
How Do I Explicitly Roll Back a Transaction?
The Online and Rich Client Samples projects (program SQ06 and RSQ06)
|