Parsing and Replacement Statements - Example

The sample code below shows an example of the parsing and replacement statements that are required for the customization of session handling.

Note: The original session ID has been commented out, but it is still visible in the script.

The WebParseDataBoundEx function generated by TrueLog Explorer parses the value found between the boundaries name=\" and \" in the HTML document returned from the subsequent WebPageLink call. It then stores the actual value in the sSessionInfo1 variable. The parsing function must be specified before the Web API call from which the response data is to be parsed. To facilitate debugging, TrueLog Explorer inserts a Print statement that writes the parsed value to the Silk Performer Virtual User Output window. The session ID variable is assigned to the sFormSid1 form field variable, which is used directly in the DCLFORM script section in place of the constant session ID value (858891446).

Example

transaction TMain
begin
  ...
  WebParseDataBoundEx(sSessionInfo1, STRING_COMPLETE,
    "name=\"", 3, "\"", WEB_FLAG_IGNORE_WHITE_SPACE | 
    WEB_FLAG_CASE_SENSITIVE, 1);
  WebPageLink("Check out", "ShopIt - Check Out"); // Link 3
  Print("sSessionInfo1: " + sSessionInfo1);
  
  ...

  sFormSid1 := sSessionInfo1;
  WebPageUrl("http://lab3/ShopItV60/kindofpayment.asp",
    "kindofpayment.asp", SHOPITV60_KINDOFPAYMENT_ASP004);
  ...
end TMain;

dclform
  ...
  SHOPITV60_KINDOFPAYMENT_ASP004:
    ...
//     "sid"                       := "858891446";
    "sid"                       := sFormSid1;
  ...