Share this page

# Example: lr_paramarr_idx and lr_paramarr_len

This example shows how to get the last value from a parameter array.

    int arrSize;
    int ord;
    char * FlightVal;
    web_reg_save_param("outFlightVal",
        "LB=outboundFlight value=", "RB=>",
        "ORD=ALL",
        "SaveLen=18",
        LAST );
    web_submit_form("reservations.pl",
        "Snapshot=t4.inf",
        ITEMDATA,
        "Name=depart", "Value=London", ENDITEM,
        "Name=departDate", "Value=08/16/2015", ENDITEM,
        "Name=arrive", "Value=New York", ENDITEM,
        "Name=returnDate", "Value=08/16/2015", ENDITEM,
        "Name=numPassengers", "Value=1", ENDITEM,
        "Name=roundtrip", "Value=<OFF>", ENDITEM,
        "Name=seatPref", "Value=None", ENDITEM,
        "Name=seatType", "Value=Coach", ENDITEM,
        "Name=findFlights.x", "Value=83", ENDITEM,
        "Name=findFlights.y", "Value=16", ENDITEM,
        LAST );

    Example: The result of the web_reg_save_param having been called before the web_submit_form is:
            Notify: Saving Parameter "outFlightVal_1 = 230;378;08/16/2015"
            Notify: Saving Parameter "outFlightVal_2 = 231;337;08/16/2015"
            Notify: Saving Parameter "outFlightVal_3 = 232;357;08/16/2015"
            Notify: Saving Parameter "outFlightVal_4 = 233;309;08/16/2015"
            Notify: Saving Parameter "outFlightVal_count = 4"

    arrSize = lr_paramarr_len("outFlightVal");
    FlightVal = lr_paramarr_idx("outFlightVal", arrSize);

    Example: Output: FlightVal contains the value "233;309;08/16/2015".

    // Submit a unique web request for each FlightVal in the Parameter array
        for (ord=1; ord <= arrSize; ++ord) {
            lr_save_string (lr_paramarr_idx("outFlightVal", ord), "flighVal");

            web_url("reservations.lookup",
                "URL=http://{host}/reservations/lookup?resvKey={flighVal}",
                "Resource=0",
                "RecContentType=text/html",
                "Referer=",
                "Mode=HTML",
                LAST);
        }

    Example:
        Requests will be made to:
        http://{host}/reservations/lookup?resvKey=230;378;08/16/2015
        http://{host}/reservations/lookup?resvKey=231;337;08/16/2015
        http://{host}/reservations/lookup?resvKey=232;357;08/16/2015
        http://{host}/reservations/lookup?resvKey=233;309;08/16/2015

Tips to improve your search results... VuGen Function Reference Version 25.1-25.3 Function Reference 25.1-25.3 All View Local Help Center View Online Help Center Version: