Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


Lookup This API allows you to find an array element which is less than the argument you pass to the lookup function. This API will return the index of the value if it has found a match, otherwise it will return 0.it.

An optional resulting indicators object can specify if any elements in the flags array should be set. The resulting indicators object can have this property:

  • low (Number) - identifies the flag number to set if the nearest lower entry is found
Parameters
  1. Search argument
  2. Array
  3. Start index (OR resulting indicators object)
  4. Resulting indicators object (can be nulloptional)
Return Value

Function will return Returns 0 if no matching element has been is found; otherwise, otherwise it will return the element index is returned.

Example
Code Block
languagejavascript
  pjs.define("i", { type: 'integer', length: 3, decimals: 0, initValue: 1 });
  pjs.define("SRCHWD", { type: 'char', length: 1 });
  pjs.define("arr", { type: 'char', length: 1, dim: 10, orderby: 'ASCEND' });

  arr[1] = 'A';
  arr[2] = 'B';
  arr[3] = 'C';
  arr[4] = 'C';
  arr[5] = 'C';
  arr[6] = 'D';
  arr[7] = 'E';
  arr[8] = 'E';
  arr[9] = 'F';
  arr[10] = 'G';

  SRCHWD = 'D';

  pjs.lookupLT(SRCHWD, arr, i, { low: 55 });


RPG Equivalent
 

%LOOKUPLT()