Select random parameter captured using Ord=All

Sorter picture Sorter · Feb 13, 2014 · Viewed 17.4k times · Source

How to select a random parameter captured using

web_reg_save_param("varParamName",
                   "LB=value=\"",
                   "RB=\"",
                   "Ord=All",
                   LAST);

Answer

James Pulley picture James Pulley · Feb 14, 2014

Your LB and RB conditions are too generic. Pick something more specific to what you are trying to capture

To your greater question, there are several paths on picking an ordinal depending upon your version of LoadRunner. Something which works for every version would be

char foo[50];
...
sprintf(
     foo,
     "{varParamName_%d}",
     rand() * atoi( lr_eval_string("{varParamName_count}" ) ) +1
);
...
lr_save_string(
     lr_eval_string( foo ), 
     "LR_MyRandomCorrelatedvariable"
);
    ...
lr_output_message(
     "%s", 
     lr_eval_string( "{LR_MyRandomCorrelatedvariable}" ) 
);