lr_advance_param

Advances to the next available parameter value.

int lr_advance_param( char *param );
Alphabetical Listing - C Language Utility Functions

Arguments

NameComments
param The name of the parameter in quotes (no brackets).

The lr_advance_param function causes the script to use the next available value of the parameter. If you are running multiple iterations, you can specify in the parameter properties to advance automatically to the next value for each iteration. Use this function within an iteration to advance to the next value.

The effect on other parameters in the same data file depends on the settings in the Vuser parameter list dialog.

This function is not recorded—you insert it manually into your script.

Return Values

This function returns 0 on success and -1 on failure.

Parameterization

Parameterization is not applicable to this function.

Example

In the following example, there are three parameters defined. Iteration is an Iteration Number type parameter, and Param1 and Param2 are defined in file Params.dat.The values of Param1 and Param2 are:

Param1 Param2
P1_aP2_a
P1_bP2_b
P1_cP2_c
P1_dP2_d

This script shows the effect of lr_advance_param. Param1 advances at each call to lr_advance_param, and at each new iteration. With Select next row set to "sequential" in the Vuser parameter list dialog for Param2, Param2 advances only by iteration, though it is in the same file. However, with Select next row set to "Same line as Param1", Param2 advances with Param1.

lr_output_message("Iteration %s, Param1 %s, Param2 %s",
    lr_eval_string("{Iteration}"),
    lr_eval_string("{Param1}"),
    lr_eval_string("{Param2}"));
lr_advance_param("Param1");
lr_output_message("Iteration %s, Param1 %s, Param2 %s",
    lr_eval_string("{Iteration}"),
    lr_eval_string("{Param1}"),
    lr_eval_string("{Param2}"));
Example: Output: When Select next row is set to "sequential":
Starting iteration 1.
Action.c(3): Iteration 1, Param1 P1_a, Param2 P2_a
Action.c(10): Iteration 1, Param1 P1_b, Param2 P2_a
Ending iteration 1.
Starting iteration 2.
Action.c(3): Iteration 2, Param1 P1_c, Param2 P2_b
Action.c(10): Iteration 2, Param1 P1_d, Param2 P2_b
Ending iteration 2.
When Select next row is set to "Same line as Param1":
Starting iteration 1.
Action.c(3): Iteration 1, Param1 P1_a, Param2 P2_a
Action.c(10): Iteration 1, Param1 P1_b, Param2 P2_b
Ending iteration 1.
Starting iteration 2.
Action.c(3): Iteration 2, Param1 P1_c, Param2 P2_c
Action.c(10): Iteration 2, Param1 P1_d, Param2 P2_d
Ending iteration 2.