array.lookupLE()
The lookupLE() method finds an element in a simple array or a data structure array that is less than or equal to the argument provided.
Parameters
Argument - value to search for
Start Index - position to start searching from
Element Count - number of elements to search from the starting position
Subfield (optional) - if searching a data structure array, specifies which subfield should the function look up
Return Value
Returns 0 if no matching element is found; otherwise, the element index is returned.
Example
pjs.define("NumIndex", { type: 'unsigned integer', length: 3, decimals: 0 });
pjs.define("arr", { type: 'char', length: 1, dim: 10, orderby: 'ASCEND' });
arr[1] = 'A';
arr[2] = 'C';
arr[3] = 'C';
arr[4] = 'C';
arr[5] = 'E';
arr[6] = 'E';
arr[7] = 'G';
arr[8] = 'L';
arr[9] = 'J';
arr[10] = 'V';
NumIndex = arr.lookupLE('D', 1, 10);
RPG Equivalent
%LOOKUPLE()