Initializing help system before first use

InsightArrayIterator

Iterator class for the InsightArray. Instantiated by getIterator() on the InsightArray object.

Method summary

name description
moveBefore Set the cursor position.
moveBeforeFirst Resets the iterator back to the start.
next Retrieves the next element in the Insight Array.

Methods

method
moveBefore ( ) → {InsightArrayIterator}

Position the cursor so that the next element returned will be the one specified by the passed in key. If the key does not exist then there is no change to the cursor position.

details
Returns:
returns table
Type Description
type
InsightArrayIterator
the iterator to allow chaining commands
Example
examples
var key = [4]; // 4th item
var arr = scenario.getArray('INTEGER_ARRAY');
array.moveBefore(key);
array.next(); // fourth item returned
Back to Top
method
moveBeforeFirst ( ) → {InsightArrayIterator}

Resets the iterator back to the start.

details
Returns:
returns table
Type Description
type
InsightArrayIterator
the iterator to allow chaining commands
Example
examples
var arr = scenario.getArray('INTEGER_ARRAY');
array.next(); // first item
array.next(); // second item
array.next(); // third item
array.moveBeforeFirst(); // reset the cursor
array.next(); // first item
array.next(); // second item
Back to Top
method
next ( ) → {Object.<{key: Array.<(string|number|boolean)>, value: (string|number|boolean)}>|undefined}

Retrieves the next element in the Insight Array.

details
Returns:
returns table
Type Description
type
Object.<{key: Array.<(string|number|boolean)>, value: (string|number|boolean)}> | undefined
Undefined if end of data
Example
examples
var arr = scenario.getArray('INTEGER_ARRAY');
var keyValueObject;
while (keyValueObject = array.next()) {
     // do something with value
}
Back to Top