LoadRunner Practitioners Forum

dynamic input to be chosen from drop down

Frequent Contributor.

dynamic input to be chosen from drop down

Hello Everybody,


I have an application where a random value needs to be selected for "Person Responsible" from a drop down. The selected value has 2 values in the script which are related to each other like below:


"Name=prop_12345_1356", "Value=333333", ENDITEM, //<called Responsible_ID>
"Name=objnameprop_12345_1356", "Value=XDEGH - Smith, Will", ENDITEM, //<called Responsible_Name>


I have captured the list of values using web_reg_save_param() with ORD = ALL and the results are as below:


"CorrelatedValue_1 = 111111"

"CorrelatedValue_2 = AAAAAA - LastName1,  FirsName1"

"CorrelatedValue_3 = "],["BBBBBB - LastName2, FirstName2"

"CorrelatedValue_4 = 222222"

"CorrelatedValue_5 = BBBBBB - LastName2, FirstName2"

"CorrelatedValue_6 = "],["CCCCCC - LastName3, FirstName3"






"CorrelatedValue_348 ="],["ZZZZZZ - LastNameX, FirstNameX"

"CorrelatedValue_349 = 999999

"CorrelatedValue_350 =ZZZZZZ - LastNameX, FirstNameX"


I need to randomly select a Responsible_ID and input the corresponding Responsible_Name

e.g. if ordinance of ID is 1, ordinance of corresponding Name is 2

If ordinance of ID is 4, ordinance of corresponding Name is 5

If ordinance of ID is 7, ordinance of corresponding Name is 8

If ordinance of ID is 10, ordinance of corresponding Name is 11


Is there any way I can implement this using correlation?


P.S. Parameterizing the ID value and Name(with use same line as ID parameter setting) works fine but I was looking for a more dynamic solution since the values in drop down changes often.



Micro Focus Expert

Re: dynamic input to be chosen from drop down

Hi Saumi,


You can find instructions How to randomly select parameters saved by web_reg_save_param in the following document:



Kind regards,

HPE Support
If you haven’t tried it yet, come and join us in our entitled forums at Support Customer Forums

If you find that this or any post resolves your issue, please be sure to mark it as an accepted solution and give Kudos to the author for their assistance.
Trusted Contributor.

Re: dynamic input to be chosen from drop down

First of all: If you want to make life easier on yourself, change that correlation a bit, so that you capture a single list containing all the relevant data for the chosen person in a single item.

So you get this:

CorrelatedValue_1 = "11111<random_HTML ... more random HTML>AAAAAA - LastName1, FirsName1"
CorrelatedValue_2 = "222222<random_HTML ... more random HTML>BBBBBB - LastName2, FirstName2"
.. etc.

We really don't care for that random HTML in the middle, but saving it probably won't hurt us a lot and it will make this easier since we now only have a single list of items to deal with and all of them look the same.

From there, this is actually an easy problem. I use ylib for this, so I will explain it using those functions, but you can probably get the same effect without it with a little bit of C glue code.

Doing it with y-lib involves these steps:

First, we choose a random element from the correlated values:


That will save the chosen value in a parameter named "CorrelatedValue".

Second, we split that parameter into it's constituent parts:
y_left("CorrelatedValue", "<RandomHTML", "prop");
y_right("CorrelatedValue", "RandomHTML>", "propobj");

These two functions will basically save the part to the left of your random HTML into the "prop" parameter, and the part to the right of your random HTML into the "propobj" parameter.

Note that the "RandomHTML" thing is basically the right and left boundary of the correlation, just as you would have in a normal web_reg_save_param() call.


And that's basically the entire hat trick. Three easy function calls and a bit of smarts when it comes to capturing your input is all it needs.

Documentation for y_left() and y_right() can be found here:


Here is the documentation to y_array_pick_random():

Note that you'll need to put y-lib into your script first. Doing that is easy: Download the files from github (link is in my sig), right-click on extra files, choose "add files to script", and use that to add the ylib files.

Then simply add the following line at the top of vuser_init:


#include "y_lib.c"



Discover the y-lib loadrunner support library: