123 发表于 2011-5-30 16:24:06

web_reg_save_param 取到的是多个值,怎么获取最大的一个?

web_reg_save_param 取到的是多个数值,怎么获取最大的一个?

云层 发表于 2011-5-30 16:40:46

假设你关联的参数名叫做paramx,代码就是
lr_paramarr_idx(paramx,atoi(lr_eval_string("paramx_count")))

123 发表于 2011-5-30 16:55:18

我试试

123 发表于 2011-5-30 17:11:33

web_reg_save_param("Oderid", "LB=<REC><OR_N>", "RB=<","Ord=All",
    LAST);

lr_paramarr_idx("Oderno",atoi(lr_eval_string("Oderid_count")));


lr_output_message("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&Oderid's value is %s",lr_eval_string("{Oderid}"));
lr_output_message("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&Oderno's value is %s",lr_eval_string("{Oderno}"));


-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Action.c(22): Notify: Saving Parameter "Oderid_1 = 705220"
Action.c(22): Notify: Saving Parameter "Oderid_2 = 705222"
Action.c(22): Notify: Saving Parameter "Oderid_3 = 705221"
Action.c(22): Notify: Saving Parameter "Oderid_4 = 705223"
Action.c(22): t=3378ms: Request done "http://172.16.2.15:16955/tradeweb/httpXmlServlet"   
Action.c(22): Notify: Saving Parameter "Oderid_count = 4"
Action.c(22): web_custom_request("httpXmlServlet_18") was successful, 1342 body bytes, 141 header bytes   
Action.c(33): Warning: The string 'Oderid' with parameter delimiters is not a parameter.
Action.c(33): &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&Oderid's value is {Oderid}
Action.c(35): Warning: The string 'Oderno' with parameter delimiters is not a parameter.
Action.c(35): &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&Oderno's value is {Oderno}


怎么得不到最大值?

云层 发表于 2011-5-30 17:34:15

好吧我写错了一点
char *x;

x=lr_paramarr_idx("Oderno",atoi(lr_eval_string("{Oderid_count}")));

msnshow 发表于 2011-5-30 22:48:30

;P

123 发表于 2011-5-31 10:31:45

char * x;
        web_custom_request("httpXmlServlet_17",
                "URL=http://172.16.2.15:16955/tradeweb/httpXmlServlet",
                "Method=POST",
                "Resource=0",
                "RecContentType=text/xml",
                "Referer=",
                "Snapshot=t19.inf",
                "Mode=HTML",
                "Body=<?xml version=\"1.0\" encoding=\"gb2312\"?><GNNT><REQ name=\"order\"><USER_ID>001888005</USER_ID><CUSTOMER_ID>00188800500</CUSTOMER_ID><BUY_SELL>1</BUY_SELL><COMMODITY_ID>99BCK</COMMODITY_ID><PRICE>2222</PRICE><QTY>1</QTY><SETTLE_BASIS>1</SETTLE_BASIS><CLOSEMODE>0</CLOSEMODE><TIMEFLAG>0</TIMEFLAG><L_PRICE>0</L_PRICE><SESSION_ID>{UserSession}</SESSION_ID><BILLTYPE>0</BILLTYPE></REQ></GNNT>",
                LAST);
        web_reg_save_param("Oderid", "LB=<REC><OR_N>", "RB=<","Ord=All",
           LAST);
       
        web_custom_request("httpXmlServlet_18",
                "URL=http://172.16.2.15:16955/tradeweb/httpXmlServlet",
                "Method=POST",
                "Resource=0",
                "RecContentType=text/xml",
                "Referer=",
                "Snapshot=t20.inf",
                "Mode=HTML",
                "Body=<?xml version=\"1.0\" encoding=\"gb2312\"?><GNNT><REQ name=\"my_weekorder_query\"><USER_ID>001888005</USER_ID><BUY_SELL>0</BUY_SELL><ORDER_NO>0</ORDER_NO><COMMODITY_ID></COMMODITY_ID><STARTNUM>0</STARTNUM><RECCNT>0</RECCNT><UT>1306396699133</UT><SESSION_ID>{UserSession}</SESSION_ID><MARKET_ID></MARKET_ID></REQ></GNNT>",
                LAST);

        x = lr_paramarr_idx("Oderid",atoi(lr_eval_string("{Oderid_count}")));
        lr_output_message("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&Oderid's value is %s",lr_eval_string("{Oderid}"));
        lr_output_message("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&Oderno's value is %s",lr_eval_string(x));
-------------------------------------------------------------------------------------------------------------------------------------------------------
Action.c(18):   F><B_T_T>0</B_T_T></REC></RESULTLIST></REP></GNNT>
Action.c(18): Notify: Saving Parameter "Oderid_5 = 705043"
Action.c(18): Notify: Saving Parameter "Oderid_6 = 705050"
Action.c(18): Notify: Saving Parameter "Oderid_7 = 705045"
Action.c(18): Notify: Saving Parameter "Oderid_8 = 705046"
Action.c(18): Notify: Saving Parameter "Oderid_9 = 705048"
Action.c(18): Notify: Saving Parameter "Oderid_10 = 705047"
Action.c(18): t=1781ms: Request done "http://172.16.2.15:16955/tradeweb/httpXmlServlet"       
Action.c(18): Notify: Saving Parameter "Oderid_count = 10"
Action.c(18): web_custom_request("httpXmlServlet_18") was successful, 3169 body bytes, 141 header bytes       
Action.c(29): Notify: Parameter Substitution: parameter "Oderid_count" ="10"
Action.c(29): Notify: Parameter Substitution: parameter "Oderid_10" ="705047"
Action.c(30): Warning: The string 'Oderid' with parameter delimiters is not a parameter.
Action.c(30): &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&Oderid's value is {Oderid}
Action.c(31): &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&Oderno's value is 705047
-------------------------------------------------------------------------------------------------------------
没有列出来最大的一个!!!

123 发表于 2011-5-31 10:36:25

不能取 Oderid_count = 10   里面的值没有排序

scntwa 发表于 2011-5-31 14:03:16

char *str;
int i=0;
int value=0;
int temp=0;

for(i=1;i<= lr_paramarr_len("Oderno");i++) {




        value=atoi(lr_paramarr_idx("Oderno",i));
        if(value>temp) {
                temp =value;
                str=lr_paramarr_idx("Oderno",i);
        }

}

123 发表于 2011-5-31 14:55:41

用楼上代码搞定了,下面是运行结果。
----------------------------------------------------------------------------------------------------------------------
Action.c(21): Notify: Saving Parameter "Oderid_1 = 705073"
Action.c(21): Notify: Saving Parameter "Oderid_2 = 705051"
Action.c(21): Notify: Saving Parameter "Oderid_3 = 705075"
Action.c(21): Notify: Saving Parameter "Oderid_4 = 705074"
Action.c(21): t=3060ms: Request done "http://172.16.2.15:16955/tradeweb/httpXmlServlet"       
Action.c(21): Notify: Saving Parameter "Oderid_count = 4"
Action.c(21): web_custom_request("httpXmlServlet_18") was successful, 1323 body bytes, 141 header bytes       
Action.c(33): Notify: Parameter Substitution: parameter "Oderid_count" ="4"
Action.c(34): Notify: Parameter Substitution: parameter "Oderid_1" ="705073"
Action.c(37): Notify: Parameter Substitution: parameter "Oderid_1" ="705073"
Action.c(33): Notify: Parameter Substitution: parameter "Oderid_count" ="4"
Action.c(34): Notify: Parameter Substitution: parameter "Oderid_2" ="705051"
Action.c(33): Notify: Parameter Substitution: parameter "Oderid_count" ="4"
Action.c(34): Notify: Parameter Substitution: parameter "Oderid_3" ="705075"
Action.c(37): Notify: Parameter Substitution: parameter "Oderid_3" ="705075"
Action.c(33): Notify: Parameter Substitution: parameter "Oderid_count" ="4"
Action.c(34): Notify: Parameter Substitution: parameter "Oderid_4" ="705074"
Action.c(33): Notify: Parameter Substitution: parameter "Oderid_count" ="4"
Action.c(41): &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&Oderno's value is 705075

云层 发表于 2011-5-31 19:26:06

汗死我给你的代码x里面已经是最大值了,你没看懂而已

superliming 发表于 2011-6-1 10:42:17

Action()
{
        int j;
        int i;
        int id_count;
        int max;
        lr_save_string("1","id_1");
        lr_save_string("3","id_2");
        lr_save_string("5","id_3");
        lr_save_string("2","id_4");
        lr_save_string("4","id_count");
        id_count=lr_paramarr_len("id");
        max=atoi(lr_paramarr_idx("id",1));
        for(i=1;i<=id_count;i++)
        {
               j=atoi(lr_paramarr_idx("id",i));
               if(max<j)
               {
                       max=j;
               }
        }
        lr_output_message("%d",max);
        return 0;
}

superliming 发表于 2011-6-1 10:42:23

Action()
{
        int j;
        int i;
        int id_count;
        int max;
        lr_save_string("1","id_1");
        lr_save_string("3","id_2");
        lr_save_string("5","id_3");
        lr_save_string("2","id_4");
        lr_save_string("4","id_count");
        id_count=lr_paramarr_len("id");
        max=atoi(lr_paramarr_idx("id",1));
        for(i=1;i<=id_count;i++)
        {
               j=atoi(lr_paramarr_idx("id",i));
               if(max<j)
               {
                       max=j;
               }
        }
        lr_output_message("%d",max);
        return 0;
}

123 发表于 2011-6-3 15:09:51

搞定了 谢了
页: [1]
查看完整版本: web_reg_save_param 取到的是多个值,怎么获取最大的一个?