Versions Compared

Key

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

The lookup function provides the functionality to look for a certain element in an array (and data-structure array) which lookupLT() method finds an element in a simple array or a data structure array that is less than the argument provided.

Parameters
  1. Argument - Value searching value to search for
  2. Start Index - position to start searching from this index
  3. Element Count - for this many elementsSubfield number of elements to search from the starting position
  4. Subfield (optional) - if searching in a data - structure array, specifies which subfield should the function look up. Can be null.
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("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);

...