Share this page

# lr_user_data_point_instance

Records a user-defined data sample and correlates it to a transaction instance.

    long lr_user_data_point_instance( char *sample_name, double value, long transaction_handle );

Alphabetical Listing - C Language Utility Functions

## Arguments

Name | Comments
--- | ---
sample_name | A string indicating the name of the sample type.
value | The value to record.
parent_handle | A transaction instance identifier with which to associate the data_point.

The lr_user_data_point_instance function is similar to lr_user_data_point except that lr_user_data_point_instance has a transaction_handle parameter. This parameter allows you to associate a data point with a specific transaction instance.

This function is intended for use with applications integrated with OpenText Professional Performance Engineering that use transaction instances.

For details on transaction instances, see lr_start_transaction_instance.

## Return Values

This function returns 0 if it succeeds, and -1 if it fails to write the sampled data.

## Parameterization

All string arguments (char type) can be parameterized using standard parameterization.

## Example

In the following example,lr_start_transaction_instance measures the duration a withdrawal from a bank server. Once the server API call is completed and returns a value to the status variable, the transaction instance is complete. Each successful instance of the transaction is accompanied by a data point instance that records the amount overdrawn with the transaction. This is achieved by passing the instance_id of the transaction to lr_user_data_point_instance.

Copy code

    int LIMIT=1000;
    long instance_id;
    int amount_overdrawn = get_amount_overdrawn(); <span style="font-style: italic;">/* Call to server API */</span>
    while (amount_overdrawn < LIMIT) {
        /* Notify that a transaction is starting */
        instance_id = lr_start_transaction_instance("withdraw", 0);
        status = bank_withdraw(500); <span style="font-style: italic;">/* Call to server API */</span>
       /* End transaction with operation result - pass or fail */
        if (status == 0)
        {
            /* Before ending the transaction, record the amount
            * overdrawn as a data point and associate it with
            * the specific transaction instance by using the
            * instance's id */
            lr_user_data_point_instance("Amount Overdrawn",
                (double)amount_overdrawn, instance_id);
            lr_end_transaction_instance(instance_id, LR_PASS);
        }
        else
            lr_end_transaction_instance(instance_id, LR_FAIL);
        amount_overdrawn = get_amount_overdrawn();
    }

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