JavaScript Functions > Alphabetical Listing of Utility Functions (lr) > lr.paramIncrement

lr.paramIncrement

Increments the value of a numerical parameter.

Example Run-Time Functions

Syntax

lr.paramIncrement( destinationParam, sourceParam ); 

Arguments

Argument Comments
destinationParam The name of the parameter to store the incremented parameter
sourceParam The name of the parameter whose value is incremented

The lr.paramIncrement function retrieves the value of sourceParam, increments its value by one, and stores the incremented value as a null terminated string in destinationParam.

sourceParam must be initialized with an integer value prior to calling lr.paramIncrement. sourceParam's value should include only single-byte digit characters with an optional sign or leading zeros.

When destinationParam exists, its value is overwritten. When it doesn't exist, the parameter is created dynamically.

The value of sourceParam is restricted to the maximum value of a long integer minus 1.

Return Values

This function returns the following values:

Constant Value Result
LR_PARAM_INC_OK  0 Success
LR_PARAM_INC_ERR_SAVE_FAILED -1 The save operation to the destination parameter failed.
LR_PARAM_INC_ERR_MBCS_IN_SRC -2 The source parameter includes multibyte characters, which indicates that it is not a pure numeric parameter.
LR_PARAM_INC_ERR_SRC_NOT_NUM -3 The source parameter includes singlebyte characters that are not digits, or the source parameter does not exist.
LR_PARAM_INC_ERR_EVAL_FAILED -4 The evaluation operation of the source parameter failed.

Parameterization

Standard parameterization is not available for this function.

Example

lr.paramIncrement("result", "{Iteration}");
lr.outputMessage(lr.evalString("{result}"));