how to get count of number of arrays in web_reg_save_param

357 views
Skip to first unread message

abhishek

unread,
Nov 30, 2009, 9:26:44 AM11/30/09
to LoadRunner
hi,
i am currently testing an application in which i create a task. Every
time i create a new instance new task id is assigned. now i have
corelated the value with web_reg_save_param with ORD=ALL. now my
question is how to get the size of array which web_reg_save_param
creates.

James Pulley

unread,
Nov 30, 2009, 9:33:34 AM11/30/09
to lr-loa...@googlegroups.com
Training? Manual? F1?
--
You received this message because you are subscribed to the Google "LoadRunner" group.
To post to this group, send email to LR-Loa...@googlegroups.com
To unsubscribe from this group, send email to
LR-LoadRunne...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/LR-LoadRunner?hl=en

Luca.C...@cedacri.it

unread,
Nov 30, 2009, 9:47:11 AM11/30/09
to lr-loa...@googlegroups.com
Return Receipt

Your Re: how to get count of number of arrays in
document: web_reg_save_param

was Luca Cattaneo/Cedacrinord_Spa/IT
received
by:

at: 30/11/2009 15.47.12





John Crunk

unread,
Nov 30, 2009, 1:43:55 PM11/30/09
to lr-loa...@googlegroups.com
There are a number of ways, you can count them, you can use array
fictions, you can do it the way the rest of us that know what we are
doing do, or you can do all of the above.

John Crunk Ph.D ABD
Sent from my iPhone

On Nov 30, 2009, at 9:26 AM, abhishek <abhishek....@gmail.com>
wrote:

Abhishek Banginwar

unread,
Nov 30, 2009, 2:08:50 PM11/30/09
to lr-loa...@googlegroups.com
@ James : i have been trained in PT for website and web services testing and am doing so for past 2 years.

each time i create a new task a new row is added to the list with new task id.
i can very well corelate and get all the task ids. As ORD can be either used like 1,2,3 or ALL, i am wondering how can i get last occurrence of task id as ORD=LAST does not exists.

@John : i cannot count them as everytime i run script new task id is created so manually counting will not help.
--
Abhishek

John Crunk

unread,
Nov 30, 2009, 2:12:09 PM11/30/09
to lr-loa...@googlegroups.com
Then use one of my other suggestions. I personnally will not give you the answer to this very basic well documented procedure


John Crunk Ph.D ABD
Sent from my iPhone

James Pulley

unread,
Nov 30, 2009, 2:14:48 PM11/30/09
to lr-loa...@googlegroups.com
Your training has been insufficient. See pairing of "ORD=all" and [varname]_count.
From: Abhishek Banginwar <abhishek....@gmail.com>
Date: Tue, 1 Dec 2009 00:38:50 +0530
Subject: Re: how to get count of number of arrays in web_reg_save_param

Roland Jefferson JR

unread,
Nov 30, 2009, 2:19:21 PM11/30/09
to lr-loa...@googlegroups.com
Is the count changing everytime you iterate the script? If so, you will have to do more research. If not. than turn the advanced loggin up and look in the log and pick the last count of the array that is being correlated and replace the code further down in your script that requires this number.
 
Hop this helps,
 
Roland

Abhishek Banginwar

unread,
Nov 30, 2009, 2:21:23 PM11/30/09
to lr-loa...@googlegroups.com
yes. it changes everytime. that is why i am having issues.

i know {param]_count is generated when i use ord=all, my question was how to get the last one not the first one.

John Crunk

unread,
Nov 30, 2009, 2:25:43 PM11/30/09
to lr-loa...@googlegroups.com
Wouldn't need to correlate if it didn't change every time duh!


John Crunk Ph.D ABD
Sent from my iPhone

Roland Jefferson JR

unread,
Nov 30, 2009, 2:45:44 PM11/30/09
to lr-loa...@googlegroups.com
The only other way is to programatically pick the last paramater coming back. There used to be a random picking method up on the HP site. You can streamline that code and use it to pick the last correlated item captured in your array.
 
About the best I can do for you right now.
 
Roland

Manny Yamzon

unread,
Nov 30, 2009, 2:48:26 PM11/30/09
to lr-loa...@googlegroups.com
abishek, if you can get the {param}_count, then just point your array to whatever the {param}_count is.. if you wanted to select the last member...

John Crunk

unread,
Nov 30, 2009, 2:50:05 PM11/30/09
to lr-loa...@googlegroups.com
This thread is an example of the piss poor "loadrunner experts" we have in the industry. I can do what he wants to do in exactly 0 lines of code after the web_reg_save_param has been executed


John Crunk Ph.D ABD
Sent from my iPhone

Roland Jefferson JR

unread,
Nov 30, 2009, 2:56:57 PM11/30/09
to lr-loa...@googlegroups.com
Excellent! Since you are a capable programmer then, please assist our newbie friend!
God Bless,
Roland

ashok kumar

unread,
Nov 30, 2009, 9:48:42 AM11/30/09
to lr-loa...@googlegroups.com
Mr ''Luca.C...@cedacri.it"


turn this off

thanks
Ashok

Floris Kraak

unread,
Nov 30, 2009, 5:39:24 PM11/30/09
to lr-loa...@googlegroups.com
On Mon, Nov 30, 2009 at 8:21 PM, Abhishek Banginwar
<abhishek....@gmail.com> wrote:
> yes. it changes everytime. that is why i am having issues.
>
> i know {param]_count is generated when i use ord=all, my question was how to
> get the last one not the first one.
>

Easy.

Say you've saved "param_1" through "param_15".

Then you just write:
lr_eval_string(lr_eval_string("{param_{param_count}}"));

Tadaa ;-)
It's a bit of a dirty trick but it works.
Nowadays I usually use my own functions though. This would be roughly:

y_array_get("param", y_array_count("param"));


Regards,
Floris
---
'What does it mean to say that one is 48% slower? That's like saying
that a squirrel is 48% juicier than an orange - maybe it's true, but
anybody who puts the two in a blender to compare them is kind of
sick.'
--- Linus Torvalds

Floris Kraak

unread,
Nov 30, 2009, 5:42:40 PM11/30/09
to lr-loa...@googlegroups.com
On Mon, Nov 30, 2009 at 11:39 PM, Floris Kraak <rand...@gmail.com> wrote:
>
> Easy.
>
> Say you've saved "param_1" through "param_15".
>
> Then you just write:
> lr_eval_string(lr_eval_string("{param_{param_count}}"));
>
> Tadaa ;-)
> It's a bit of a dirty trick but it works.
> Nowadays I usually use my own functions though. This would be roughly:
>
> y_array_get("param", y_array_count("param"));
>

To be honest though I wouldn't usually pick the last one: I'd use
y_pick_random("param") - which picks a random one and saves it as a
parameter named "param".

(Don't look for y_pick_random() in the loadrunner documentation - I'll
post it publicly somewhere once the pressure comes off my current set
of projects but until then you'll have to make do without)

Luca.C...@cedacri.it

unread,
Dec 1, 2009, 2:58:07 AM12/1/09
to lr-loa...@googlegroups.com
Return Receipt

Your Re: how to get count of number of arrays in
document: web_reg_save_param

was Luca Cattaneo/Cedacrinord_Spa/IT
received
by:

at: 01/12/2009 08.58.09





abhishek

unread,
Dec 1, 2009, 9:18:41 AM12/1/09
to LoadRunner
GOT IT. just to let others know;

if my parameter name is TID;

lr_eval_string("{TID_count}") -> gives total number of parameters
generated by web_reg_save_param
atoi(lr_eval_string("{TID_count}")) -> gives the same thing in
integer

Thanks for the info Floris.

James Pulley

unread,
Dec 1, 2009, 9:30:32 AM12/1/09
to lr-loa...@googlegroups.com
Talk to your training department at your employer. If they are not covering things like this in training and mentoring then your employer is doing you and their clients a great disservice. They are setting you both up for failure.

24 hours for a one minute fix (if you had the proper training and mentoring). This is why trained and mentored will always be less expensive to the client because there is no price so low that it can accommodate such inefficiencies.

Roland Jefferson JR

unread,
Dec 1, 2009, 9:38:52 AM12/1/09
to lr-loa...@googlegroups.com
I would suggest you go for some training from HP, However this type of training is limited and will only come as you get a guru buddy and more project experience.  Also make sure your c programming is untouchable!
All the best,
Roland

Luca.C...@cedacri.it

unread,
Dec 1, 2009, 9:55:58 AM12/1/09
to lr-loa...@googlegroups.com
at: 01/12/2009 15.56.00





Reply all
Reply to author
Forward
0 new messages