需求:通过关联取得的ParamName参数可能存在多个值,需要对每个ParamName参数值进行处理
脚本:可通过3种不同的实现方式,将每个参数值作为HTTP请求内容发出

 web_reg_save_param("ParamName",
  "LB/IC=\"id\":\"OutputParameter.",
  "RB/IC=\",\"",
  "Ord=All",
  "Search=Body",
  "RelFrameId=1",
  LAST);
  
 ...
 
 
 Paramcount=atoi(lr_eval_string("{ParamName_count}")); //参数个数
 i=1;
 while (i<=Paramcount) {
  sprintf(str,"{ParamName_%d}",i);        //生成ParamName_i
 
 //方法一:将变量转为参数,直接在请求中使用参数
 lr_save_string(lr_eval_string(str),"Value"); //对每个参数进行处理
 web_submit_data("FreeQueryServlet_24",
  "Action=http://datasvr01:8081/freequery/FreeQueryServlet",
  "Method=POST",
  "RecContentType=text/html",
  "Referer=http://datasvr01:8081/freequery/js/freequery/businessview/Preview.html",
  "Snapshot=t27.inf",
  "Mode=HTTP",
  ITEMDATA,
  "Name=className", "Value=ClientReportService", ENDITEM,
  "Name=methodName", "Value=addNewParam", ENDITEM,
  "Name=params", "Value=[\"{ClientID}\",\"OutputParameter.{Value}\",\"\"]", ENDITEM,
  LAST);

 

 //方法二:通过strcpy、strcat方式组织字符串,通过变量发送请求
 strcpy(s,"Value=[\"{ClientID}\",\"OutputParameter.");
  strcat(s,str);
 strcat(s,"\",\"\"]");
 web_submit_data("FreeQueryServlet_24",
  "Action=http://datasvr01:8081/freequery/FreeQueryServlet",
  "Method=POST",
  "RecContentType=text/html",
  "Referer=http://datasvr01:8081/freequery/js/freequery/businessview/Preview.html",
  "Snapshot=t27.inf",
  "Mode=HTTP",
  ITEMDATA,
  "Name=className", "Value=ClientReportService", ENDITEM,
  "Name=methodName", "Value=addNewParam", ENDITEM,
  "Name=params", s, ENDITEM,
  LAST);
  

 //方法三:通过sprintf格式化输出生成需要的字符串,通过变量发送请求
 sprintf(s,"Value=[\"{ClientID}\",\"OutputParameter.%s\",\"\"]",str);
 web_submit_data("FreeQueryServlet_24",
  "Action=http://datasvr01:8081/freequery/FreeQueryServlet",
  "Method=POST",
  "RecContentType=text/html",
  "Referer=http://datasvr01:8081/freequery/js/freequery/businessview/Preview.html",
  "Snapshot=t27.inf",
  "Mode=HTTP",
  ITEMDATA,
  "Name=className", "Value=ClientReportService", ENDITEM,
  "Name=methodName", "Value=addNewParam", ENDITEM,
  "Name=params", s, ENDITEM,
  LAST);

 i++;
 }