Highlighted
Contributor.
Contributor.
286 views

Parameterizing parameter file

 

I am working on a scenario where I have 3 user contexts. Each user will need to submit data 5 times. Each submit data will have 4 different values.

I could handle the 3 user logins with parameterization

  web_submit_data("login",
    "Action=.../login",
    "Method=POST",
    "RecContentType=text/html",
    "Referer=",
    "Snapshot=t4.inf",
    "Mode=HTML",
    ITEMDATA,
    "Name=utf8", "Value=...“", ENDITEM,
    "Name=token", "Value={token}", ENDITEM,
    "Name=id", "Value={UserId}",ENDITEM,
    "Name=pwd", "Value=Somepwd", ENDITEM,

LAST);

To submit data 5 times, I did a for loop.

   for(i = 1; i <= 5; i++)
   {
    // Submit data
   }

The challenge I am encountering is with submitting 4 different values. Because the preferrable option is a list of values per User, I have created parameter files for each user, PO_{UserId}. My intention behind doing this is to make vugen pick each file and parse through the file for 4 values and submit 4 values. I have setup the option of Sequential->Per occurance for PO_{UserId} parameter file. This is not working as expected. I am reusing the csv upload concept that I had used earlier where I set value with sample_{UserId}.csv and File=yes. I understand the scenario here is different and we are not looking at using the file's contents in one go but to parse the file and submit data 4 times. I really appreciate any assistance.

  for(i = 1; i <= Count; i++)
   {
 web_submit_data("Submit_i",
    "Action=...",
    "Method=POST",
    "Referer=...",
    "Snapshot=t6.inf",
    "Mode=HTML",
    ITEMDATA,
    "Name=id", "Value={LR_MyId}", ENDITEM,
    "Name=preferable_option", "Value={PO_{UserId}}", ENDITEM,
    LAST);
  }
0 Likes
1 Reply
Highlighted
Frequent Contributor.
Frequent Contributor.

Re: Parameterizing parameter file

Hello, arach,

You have to add a lr_eval_string(). Since to get the real value, your string need to be evaluate twice, and web_submit_data internally will evaluate once.  

 web_submit_data("Submit_i",
...
    "Name=preferable_option", lr_eval_string("Value={PO_{UserId}}"), ENDITEM,
LAST);

 

Regards,

Bingle

The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.