LoadRunner web_reg_save_param, ord=all, paramName_count issues

Chazara picture Chazara · Feb 16, 2015 · Viewed 23.8k times · Source

I am using LoadRunner version 12.02 - Build 2739

Looking at an old, yet correct 'guide' shows that I have used the statements correctly (3rd Point, around 1/3rd of the way down the page, inside the code block - the atoi statement).

But I am still unable to convert the _count parameter to an int-Variable.

In the script, before the call is made;

web_reg_save_param(
"ParamName=rotaPeople",
"LB=someText",
"RB=\")",
"Ord=ALL",
LAST);

After the web call the save_param function is placed before, the output log shows;

Notify: Saving Parameter "ParamName=rotaPeople_count = 21".

Inside the script, after the call is made, and the count has been totaled;

lr_output_message("RP_C:%d",lr_eval_string("{rotaPeople_count}"));
lr_output_message("RP_C:%s",lr_eval_string("{rotaPeople_count}"));
peoplesCount = atoi(lr_eval_string("{rotaPeople_count}"));
lr_output_message("PC:%d",peoplesCount);

In the logs after the above executions are made;

Warning: The string 'rotaPeople_count' with parameter delimiters is not a parameter.
RP_C:110826864
Warning: The string 'rotaPeople_count' with parameter delimiters is not a parameter.
RP_C:{rotaPeople_count}
Warning: The string 'rotaPeople_count' with parameter delimiters is not a parameter.
PC:0

Anyone have any ideas?

Note: The Warning messages are expected

Note: Workaround: Used web_reg_save_param_regex() and created a regular expression. Using the returned _count parameter within a for-loop worked. Keeping question open, as the original problem still persists

Answer

Buzzy picture Buzzy · Feb 17, 2015

The problem is that you use a soon to be deprecated API web_reg_save_param which does not support the ParamName syntax. In this API the second parameter is always the parameter name and therefore the correct use would be:

web_reg_save_param(
"rotaPeople",
"LB=someText",
"RB=\")",
"Ord=ALL",
LAST);

The proper API to use is web_reg_save_param_ex which does support the syntax you used so the call should look like:

web_reg_save_param_ex(
"ParamName=rotaPeople",
"LB=someText",
"RB=\")",
"Ord=ALL",
LAST);

Then the rest of your code should work properly.

I am not sure what you are doing but you might want to take a look at the somewhat unknown API lr_paramarr_random which will automatically pull a random value from the parameters array.