Share this page

# lr.endTransaction

Marks the end of a transaction.

Example | Transaction Functions

## Syntax

    lr.endTransaction( transactionName, status ) ;

## Arguments

Argument | Comments
--- | ---
transactionName | The name of an existing transaction.
status | The Transaction Status

The lr.endTransaction function marks the end of a transaction and records the amount of time it took to perform the transaction. To indicate a transaction to be analyzed, place the lr.startTransaction function before the transaction, and the lr.endTransaction function after the transaction.

If status is lr.AUTO, then the value of status is automatically assigned. By default, this value is lr.PASS signifying a successful transaction. However, if prior to lr.endTransaction, you change the default value using lr.setTransactionStatus or lr.failTransWithError, then this is the value which is passed as status in lr.endTransaction.

If you make a series of calls to functions that modify the lr.AUTO status, then it is the last call before lr.endTransaction which effectively changes the status.

## Return Values

On success, returns 0. Returns -1 if the transaction name is illegal or if there is no prior call to lr.startTransaction with a transaction of the same name.

## Parameterization

You cannot use standard parameterization for any arguments in this function.

## Example

    function Action(){
        /* Notify that a transaction is starting */

       lr.startTransaction("deposit");

       /* Server API call */

       rc = bank_deposit (50);

       /* End transaction with operation result */

       if (rc == 0)

           lr.endTransaction("deposit", lr.PASS);

       else

           lr.endTransaction("deposit", lr.FAIL);
    return 0;
    }

See also: Example: Transactions

Tips to improve your search results... VuGen Function Reference Version 25.1-25.3 Function Reference 25.1-25.3 All View Local Help Center View Online Help Center Version: