Parameter Arrays

Some functions find matches inside data and save the results in a parameter. When more than one match is located, some of these functions save data in multiple parameters, numbered to emulate an array.

The members of the array are named with the base parameter name, an underscore, and an ordinal number. The number of items found is stored in a parameter named with the base parameter name, an underscore and "count".

For example:

  1. A function is passed an output parameter name, "myparam".
  2. The function returns 10 values.
  3. The function creates 10 parameters and assigns the return values to them. The parameter names are myparam_1, myparam_2, myparam_3, ..., myparam_10.
  4. The function creates parameter myparam_count, and assigns it the value 10.

Some of the functions that can create parameter arrays are lr.saveParamRegexp, web.regSaveParamEx, web.regSaveParamXpath, web.regSaveParamRegexp, and sapgui_call_method_of_active_object_ex.

Concept Link IconSee Also

Example of Parameter Array Use

In this example, lr.saveParamRegexp is used to search a buffer and find all the substrings containing "XX", any two characters, and "YY".


function Action()
{
    var  bufferToSearch = '_a_XX11YY_b_Xx22yy_c_XX33YY_d_XX44YY_abcde';

    lr.saveParamRegexp ({
        bufferToSearch: bufferToSearch,
        regExp: {value: '(XX..YY)', flag: 'IC'},
        ordinal: 'All',
        resultParam: 'reMatchesParam',        
    });


    var matchCt = lr.paramarrLen('reMatchesParam');

    lr.message(matchCt + ' match(es) found.');

    for (var ord=1; ord <= matchCt; ord++){
        lr.message( lr.paramarrIdx('reMatchesParam', ord));
        lr.message( lr.evalString('{reMatchesParam_' + ord + '}'));
    }

    return 0;  
}