correlation

web_reg_save_param function explained

As explained in one of my previous posts, web_reg_save_param is THE most important function when you are working with LoadRunner. We will start with the syntax and then touch upon some examples to get a clear idea.

int web_reg_save_param (const char *mpszParamName, <List of Attributes>,LAST);

Find below the available attributes [<List Of Attributes>]. Note that the attribute value strings (e.g. Search=all) are not case sensitive.

NotFound The handling method when a boundary is not found and an empty string is generated. “ERROR,” the default, indicates that VuGen should issue an error when a boundary is not found. When set to “EMPTY,” no error message is issued and script execution continues. Note that if Continue on Error is enabled for the script, then even when NOTFOUND is set to “ERROR,” the script continues when the boundary is not found, but it writes an error message to the Extended log file.

LB The left boundary of the parameter or the dynamic data. This parameter must be a non-empty, null-terminated character string. Boundary parameters are case sensitive; to ignore the case, add “/IC” after the boundary. Specify “/BIN” after the boundary to specify binary data.

RB The right boundary of the parameter or the dynamic data. This parameter must be a non-empty, null-terminated character string. Boundary parameters are case sensitive; to ignore the case, add “/IC” after the boundary. Specify “/BIN” after the boundary to specify binary data.

RelFrameID The hierarchy level of the HTML page relative to the requested URL.

Search The scope of the search—where to search for the delimited data. The possible values are Headers (search only the headers), Body (search only Body data, not headers), or ALL (search Body and headers). The default value is ALL.

ORD This optional parameter indicates the ordinal or occurrence number of the match. The default ordinal is 1. If you specify “All,” it saves the parameter values in an array.

SaveOffset The offset of a sub-string of the found value, to save to the parameter. The default is 0. The offset value must be non-negative.

Savelen The length of a sub-string of the found value, from the specified offset, to save to the parameter. The default is -1, indicating until the end of the string.

Convert The conversion method to apply to the data:

HTML_TO_URL: convert HTML-encoded data to a URL-encoded data format

HTML_TO_TEXT: convert HTML-encoded data to plain text format

Examples:

The examples below are taken from the LoadRunner tutorial to give clarity on topic. We will see more examples in the coming posts.

Sample Correlation for Web Vusers
Suppose the script contains a dynamic session ID:

web_url(“FirstTimeVisitors”,”URL=/exec/obidos/subst/help/first-time-visitors.html/002-8481703-4784428>Buy books for a penny “, “TargetFrame=”,”RecContentType=text/html”,”SupportFrames=0″,LAST);

The dynamic id here is 002-8481703-4784428

You insert a web_reg_save_param statement before the above statement:

web_req_save_param (“user_access_number”, “NOTFOUND=ERROR”,”LB=first-time-visitors.html/”,”RB=>Buy books for a penny”, “ORD=6″,LAST);

ORD=6 saves the sixth occurrence of the value in user_access_number. I think everything else is self explanatory

After implementing correlated statements, the modified script looks like this, where user_access_number is the name of the parameter representing the dynamic data.

web_url(“FirstTImeVisitors”,”URL=/exec/obidos/subst/help/first-time-”“visitors.html/{user_access_number}Buy books for a penny “,
“TargetFrame=”,”RecContentType=text/html”,”SupportFrames=0″,LAST);

Note: Each correlation function retrieves dynamic data once, for the subsequent HTTP request. If another HTTP request at a later point in the script generates new dynamic data, you must insert another correlation function.

Also as I wrote in my last post don’t confuse correlation with parameter which you might have used in tools like QTP to pass varying values. Parameter is not a dynamic value captured from server response but it is something for which the user has predefined data values available.

Tips to identify the dynamic string boundaries:

  • Always analyze the location of the dynamic data within the HTML code itself, and not in the recorded script.
  • Identify the string that is immediately to the left of the dynamic data. This string defines the left boundary of the dynamic data.
  • Identify the string that is immediately to the right of the dynamic data. This string defines the right boundary of the dynamic data.
  • web_reg_save_param looks for the characters between (but not including) the specified boundaries and saves the information beginning one byte after the left boundary and ending one byte before the right boundary. web_reg_save_param does not support embedded boundary characters.

For example, if the input buffer is {a{b{c} and “{” is specified as a left boundary, and “}” as a right boundary, the first instance is c and there are no further instances—it found the right and left boundaries but it does not allow embedded boundaries, so “c” is the only valid match. By default, the maximum length of any boundary string is 256 characters.
Include a web_set_max_html_param_len function in your script to increase the maximum permitted length. For example, the following function increases the maximum length to 1024 characters: web_set_max_html_param_len(“1024”);

Discussion

42 Responses to “web_reg_save_param function explained”

  1. Hi,

    I’ve a doubt here. In my sripts i’ve identified the dynamic value and tried correlation. The issue i faced here is the same dynamic values present with differnt boundary values. Do i need to include different functiona for earch or shall i use the same function throught out.

    Posted by Senthil | June 17, 2008, 1:23 pm
  2. dynamic boundaries with different boundary values…Can you elaborate more on this?

    probably you can consider using DIG flag in WRSP

    Posted by Ankur | June 17, 2008, 2:31 pm
  3. Adding more to comments 2:

    I’m working on a banking application, where the script has generated an dynamic value in the login page with different boundaries. The same values appears in across the page with different boundaries. I got confused with this. I tried different correlation for all the values.

    Please let me know if you need more clarification.

    Posted by senthilkumar.v | June 17, 2008, 9:06 pm
  4. well, I was looking for the boundaries you were getting.

    anyways, can you show me the code? Please ensure proper formatting.

    Posted by Ankur | June 17, 2008, 9:28 pm
  5. Sorry i don’t av the code. Let me update you tomorrow.

    Posted by senthilkumar.v | June 17, 2008, 10:26 pm
  6. Please can anyone suggest me good training centers for Load Runner in Bangalore

    Posted by aravind | August 6, 2008, 1:10 pm
  7. Hello.

    I am facing some problem to dealt with Correlation.

    The dynamic value is not present in the server response of any of the previous request in generation log.

    Can any body explain me how to get it’s boundry whwn u r not recieving these dynamic valuse in the previous request.

    Posted by Sumit Arneja | September 1, 2008, 8:14 pm
  8. senthilkumar:
    Fine following link ….you mat get solution for your question.

    http://motevich.blogspot.com/2007/10/loadrunner-scripts-correlation-tutorial.html

    Posted by lrperftest | September 11, 2008, 11:30 pm
  9. hi,

    let me know how to find the dynamic values in winsock vuser script.

    Posted by praveen | April 27, 2009, 9:30 am
  10. Hi ,
    abouve information is very useful , thanks for that

    if anybody (Beginners) need help , can post quires to following id
    rajasekhar.thallapaka@in.ispace.com
    or can contact to 09000890326.
    regards,
    rajasekhar.T

    Posted by Rajasekhar | April 28, 2009, 2:28 pm
  11. I want to know when we use LB or RB as LB/IC or RB/DIG ?

    Also can you please inform me if there is any other such kind of things.

    It would be help full if I have a list of these.

    Posted by Nilanjan ghosh | September 4, 2009, 11:53 am
  12. hello,

    In the function web_reg_save_param can we have a variable value for “SaveLen” parameter

    like SaveLen>8

    That is, those values with length greater than 8

    Posted by Ajay Saini | October 30, 2009, 9:55 am
  13. Is there a way to capture the high/low values of an array? I have no problem using the web_reg_save_param function, but once I have the array of data I need to isolate the lowest value in that array. Is there a simple way to do this?

    Thanks.

    Posted by Martin | July 9, 2010, 1:05 am
  14. how to set special characters as left or right boundaries.

    Posted by sunkara | July 31, 2010, 2:08 am
  15. Hi,

    Could some one help me !
    I am facing the below issue.

    My application is web application.I am using LR 9.2 and IE8 , OS as Windows XP.
    When I replay the script i got the error as Action.c(44): Error -26226: Button not found [MsgId: MERR-26226].

    web_button(“BUTTON”,
    “Snapshot=t4.inf”,
    DESCRIPTION,
    “Type=submit”,
    “Tag=BUTTON”,
    “ID=pt1:r1:0:pt1:j_id__ctru16j_id_0″,
    ACTION,
    “UserAction=Click”,
    LAST);

    Could you please help me to fix this issue.
    What funtion do i need to add to resolve this issue.

    And also will you please tell me how to post questions on learnloadrunner.com blog

    Thanks in advance!

    Thanks,
    Raj

    Posted by Raj | December 16, 2010, 1:49 am
  16. Hi All,

    I am a beginner in this loadtesting arena.
    And i have a query to clarify.

    As you know, Using “ORD=ALL” saves the multiple occurences of a dynamic value with the same left boundary and right boundary in an array.
    Say for example if I save the varibale name as Session_ID.
    And if i need to use the 1st or 2nd occurence, I can replace the value as {Session_ID_1} and {Session_ID_2}.
    This case is working fine for me.
    But when i tried to access 4th and 5th occurence I get a warning message
    “Warning: The string ‘Session_ID_4′ with parameter delimiters is not a parameter”

    Is there any way to handle multiple occurences of a single variable having same boundaries ?

    Please Help me people !!
    Thanks in advance !!

    Posted by Prem Kumar | January 16, 2011, 5:49 pm
  17. First see what is Session_ID_Count, don’t try to access those things which are not saved.

    Your probem may be related to the listing of something: When you record for some data you might have had 5 records, but for other searches if only 2 or 3 displayed, 2 or 3 values are saved to array. Thats why if you want to use in for loop, first save no. of matches to integer variable.

    int N = atoi(lr_eval_string(“Session_ID_Count”);

    Posted by Manjunatha Prabhu | February 10, 2011, 10:15 pm
  18. char dummy[20];

    for (i=1;i<=N,i++)
    {
    sprintf("dummy", lr_eval_string("{Session_ID_%d}"),i);

    }

    Posted by Manjunatha Prabhu | February 10, 2011, 10:19 pm
  19. Hi,

    Does any body has any idea on,
    Does HP Loadrunner supports Oracle ADF Framework applicatons?

    Thanks,
    Raj

    Posted by Raj | February 10, 2011, 10:47 pm
  20. What is the Use of “LAST” attribute in Web_reg_save_param() in Loadrunner.

    Posted by Prabhu | February 18, 2011, 1:48 pm
  21. Hi Ankur,
    Nice article

    I think in your example there is a prob.you forgot to include < .
    web_url(“FirstTImeVisitors”,”URL=/exec/obidos/subst/help/first-time-”“visitors.html/{user_access_number}Buy books for a penny “,
    “TargetFrame=”,”RecContentType=text/html”,”SupportFrames=0″,LAST);

    after inserting the variable you have to include <

    Should be like this.
    web_url(“FirstTImeVisitors”,”URL=/exec/obidos/subst/help/first-time-”“visitors.html/{user_access_number}<Buy books for a penny “,
    “TargetFrame=”,”RecContentType=text/html”,”SupportFrames=0″,LAST);

    may be i am wrong please correct me.

    Posted by Rajiv | May 28, 2011, 4:11 pm
  22. I Need 1 help in Web_Reg_save_param..

    I have a left and right boundary in wic many values going to occur.
    I can capture it using ORD=all
    But i need the index of particular occurance.
    I am unable to find it.

    example:
    Leftboundary button=true rightboundary
    Leftboundary button=true rightboundary
    Leftboundary button=false rightboundary
    Leftboundary button=true rightboundary
    Leftboundary button=true rightboundary
    Leftboundary button=false rightboundary

    I want to find the index of “Leftboundary button=false rightboundary”

    Posted by Manish J Shettigat | June 17, 2011, 5:53 pm
  23. Hi,

    Can anyone help me out in knowing in how to increase the limit of “length of the correlated values” while using auto correlation rules.

    I have an idea that it could be increased by editing the limit in corr file which is uasally available in the C drive, but I am not sure where this file actuallly lies in the system.

    Any idea…!!!

    Posted by Arun Kumar | October 5, 2011, 1:56 pm
  24. Hi Guys,

    I want to define the value for RB and LB as follow for the request data,
    l_billerid=”AL1″;

    i have given
    web_reg_save_param(“P_billID”,”LB=l_billerid=”",”RB=”;\n”,”ORD=ALL”,LAST);

    But am getting error in the syntax due extra the Double Quotes in the LB and RB . How to solve this please help me. Note : I dont want to change the -_biller=”AL1″

    Posted by Prasath | January 5, 2012, 9:44 am
  25. I need to capture slash in the boundary but slash is a delimiter in web reg save param.
    please tell me how to handle it

    example
    value=FYF Gold Delta Business Card\ avalue;
    left boundary is =value=
    rightboundary is =\ avalue;
    but value is not getting captured as \ is a delimiter

    Posted by Manish | January 12, 2012, 10:40 am
  26. Hi,

    I have a doubt in Paramaterizing the script that I recorded where it filters messages, while I choose a Message catergory and date.

    I see that the POST method recalls the message category again twice,

    Do I need to parameterize all the occurances of the message category with the same parameter list/file?

    Posted by anu | January 19, 2012, 6:26 pm
  27. can ne1 tell me where the dynamic values are saved???

    Posted by amit | February 21, 2012, 12:25 am
  28. I have a question regarding the LB and RB in correlation part in Load Runner.
    If the LB and RB is keep on changing can we correlate ? If yes den how ? If any one can explain with example that will be great.!!!!!!!!!

    Posted by prashant | February 23, 2012, 4:20 pm
  29. Hi,

    Can anyone please help me, i am not able to solve this issue..

    This is how i am doing correlation. web_reg_save_param(“ID_01″,”LB=uniqueId”:”",”RB=”,”,LAST);

    But it is showing some error because of “” which is at the end of Left boundary value.(“LB=uniqueId”:”",) and same is coming for Right boundary value.
    Can any1 please solve this query of mine.

    The code is like this in which i have to correlate “1163_1155_1147_23″..

    {“aliasCuid”:”kk5mB3EACvaFT84ASxEAFE_AqDI”,uniqueId”:”1169_1155_1147_23″,”search
    CWR_Summary_by_Country.c(681): Node”:false,”kind”:”Folder”,”title”:”CWR Reports”,”aliasId”:1169,”containerId”:

    Please reply me the answer on “kunal.krishan@ignistech.com”
    or please call or text me at 09538692938.

    Thanx & Regards:
    Kunal Krishan.

    Posted by kunal | May 29, 2012, 4:17 pm
  30. @ Kunal:

    Use your correlation as below:

    web_reg_save_param(“ID_01″,
    ”LB=uniqueId\”:\””,
    ”RB=\”,”,
    LAST);

    Initially you were not using \ (seperator) in your boundary values.

    Hope this will work for you.

    Posted by Arun Kumar | June 9, 2012, 10:12 am
  31. Hi,

    I have a doubt….

    I need to print or display all the values(names of the product) from a online shopping website

    I have correlated the values(names of the product) and all the values(names of the product) are displayed in the real time data along with the count. But when i try giving lr_output_message to display the same set of product names in the replay log, i m not getting it. Can u pls explain me or help me..

    Here is the code:

    Correlation:

    web_reg_save_param(“image”,”LB=com/m/”,”RB=/140.jpg”,”ORD=ALL”,LAST);
    //com/m/mZZz88Y_68ylE8kIlzw1apA/140.jpg”
    //com/m/msFtOpt7lTAhMnDZK67H1SQ/140.jpg”

    output in real time data:
    image_count=25

    I am trying to print the correlated values(product names) in the replay log:

    for (i=1;i<=image_count;i++) {
    sprintf(names, "%s", image);

    lr_save_string(names, "Param_names");
    lr_output_message("The searched items are: %s",lr_eval_string("{Param_names}"));}

    Output: I am not getting the values(name of the product), i am getting some junk values in the replay log. Whereas i am able to see the values( product names) in the real time data.

    Posted by vijay | June 21, 2012, 6:52 pm
  32. @ Arun Kumar

    Thanks a lot.. its working now..

    Posted by kunal | June 26, 2012, 11:55 am
  33. ToGeneralLedger”:true,”RegisterGuid”:”ee042eff-58bf-e111-90ff-0050568800ce”}, i need the data ee042eff-58bf-e111-90ff-0050568800ce, when i used web_reg_save_param(“Reg_GUI_ID”,
    “LB=”RegisterGuid”:”",
    “RB=”}”;,
    “Ord=1″,
    “Search=Body”,
    “RelFrameId=1″,
    LAST);
    am getting compilation error, i tried with separator, it failed to i dentify the value.

    “LB=”RegisterGuid”\:”\”,
    “RB=”\}”;,

    with out separator i can capture the data as however i only ee042eff-58bf-e111-90ff-0050568800ce for my script and app work on Restful service. Please need help?

    Posted by preethi | June 27, 2012, 12:57 pm
  34. with out separator i can capture the data as ”:”ee042eff-58bf-e111-90ff-0050568800ce” however i only ee042eff-58bf-e111-90ff-0050568800ce for my script and app work on Restful service. Please need help?

    Posted by preethi | June 27, 2012, 12:59 pm
  35. Hi everyone,

    Please help me with this.. i am getting this warning message:

    Warning: “The string ‘”projectId”:”s:11583″‘ with parameter delimiters is not a parameter”

    I want to do correlation for this value “s:11583″ but when i am trying to find this value in the replay log. it is showing this message there..

    please help me out.

    Contact me at kunal.krishan@ignistech.com
    Phone: 09538692938

    Posted by kunal | August 8, 2012, 4:18 pm
  36. Hi everyone,
    I need your guidance about this error. i tried to do the correlation but it is showing this kind of error.. Why.?

    Error -26377: No match found for the requested parameter “DB_ID”. Check whether the requested boundaries exist in the response data. Also, if the data you want to save exceeds 256 bytes, use web_set_max_html_param_len to increase the parameter size [MsgId: MERR-26377]

    Posted by kunal | August 9, 2012, 11:41 am
  37. Hi All,

    I request you to please help me out. i am facing an issue in Load runner.. when ever i am running the script with the load of Vusers, the vusers are not stopping. i mean to say suppose i am giving the load of 5 users and i am giving the ramp up: 1 user after 5 seconds, Duration: 15 minutes, Ramp down: 1user after 5 seconds.. The script should stop within approx 20 minutes, but it is not stopping and it keeps on performing the task again and again.

    Please reply with a mail @ kunal.krishan@ignistech.com or please call me at 09538692938.

    I will be highly thankful to u.. God Bless all.
    Warm Regards
    kunal
    09538692938
    kunal.krishan@ignistech.com

    Posted by kunal | October 1, 2012, 1:54 pm
  38. Hi kamal,if u forget to give web_set_max_html_param_len means then No match found for the requested parameter “DB_ID”. this error gets displayed.

    try to give the exact LB and RB.

    if u dont know the exact LB and RB means just give web_reg_save_param(“Sample”, “LB=”, “RB=”, “Search=ALL”, LAST); then u wil get the whole response for the particualr request. from there u wil find the LB and RB

    Posted by Anand | October 10, 2012, 2:12 pm
  39. Hi
    Can anyone help me…

    This is a web application, am getting into a particular customer name from bunch of customers, i have recorded this as one transcation. I correlated this particular Id for that customer so that the next time it will pick the next customer or random customer. I dont want to parameter as it got lot of data and it keeps changing. I need the replay to pick the next customer. I couldnt correlate as it returns the same customer. Pls help.

    Posted by aruna | November 3, 2012, 3:57 am
  40. Hi
    In my script I have correlated the dynamic value. But while replaying with someother parametrized data, sometimes this value wont be there in the server response. In that case VuGen is throwing an error “Error -26377: No match found for the requested parameter”

    Tried few if-else conditions to handle the error, but failed. Please help

    Posted by Rani | December 21, 2012, 12:01 pm
  41. I got the solution :)Instead of using web_reg_save_param function, I had to use Web_reg_save_param_ex which has an attribute to handle this. “NOT FOUND = warning”

    Posted by Rani | December 28, 2012, 7:09 pm

Trackbacks/Pingbacks

  1. [...] compatibility. The first function is used often. We will touch upon details of this function in the next post… March 14, 2008 | Filed Under [...]

Post a comment

Archives

Grab My Banner

Learn LoadRunner