Share this page

# lr_paramarr_len

Returns the number of elements in a parameter array.

    int lr_paramarr_len( const char * paramArrayName);

Alphabetical Listing - C Language Utility Functions

## Arguments

Name | Comments
--- | ---
paramArrayName | The name of the parameter array.

lr_paramarr_len returns the number of elements in a parameter array.

## Return Values

The length of the array. On error, returns -1. If the parameter is not an array, returns 0.

## Parameterization

Standard parameterization is not available for this function.

See Also

## Example

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 26.1-26.3 Function Reference 26.1-26.3 All View Local Help Center View Online Help Center Version: