InsightArray
Method summary
name | description |
---|---|
getDimension | The dimension of this Array entity. |
getIterator | Retrieve an iterator for the Insight Array. |
getKeys | Gets all the populated (composite) keys. |
getName | The name of this Array entity. |
getValue | Gets the value of the element with the given indices. |
size | The size of the array. |
toObjectArray | Converts the Insight Array into an array of plain javascript objects. |
Methods
- getDimension ( ) → {insight.enums.EntityDataDimension}
-
The dimension of this Array entity.
Returns:Type Description insight.enums.EntityDataDimension The dimension of this Array entity Example
Back to Topvar arr = scenario.getArray('INTEGER_ARRAY'); arr.getDimension();
- getIterator ( sortKeys ) → {InsightArrayIterator}
-
Retrieve an iterator for the Insight Array.
Parameters:
Name Type Argument Default Description sortKeys boolean optional false Whether to sort array keys. This will use any set comparators assigned to index sets, otherwise it will fallback to default sorting based on index set data type. Warning, this is likely to reduce performance on large arrays. Returns:Type Description InsightArrayIterator Iterator class for the InsightArray Example
Back to Topvar arr = scenario.getArray('INTEGER_ARRAY'); var iter = arr.getIterator(); var valueObject; while( valueObject = iter.next() ) { var key = valueObject.key; var value = valueObject.value; }
- getKeys ( ) → {Array.<Array.<PrimitiveType>>}
-
Gets all the populated (composite) keys.
Returns:Type Description Array.<Array.<PrimitiveType>> An array of the composite keys which can be used to fetch values with getValue( compositeKey ) Example
Back to Topvar arr = scenario.getArray('INTEGER_ARRAY'); var keys = arr.getKeys();
- getName ( ) → {string}
-
The name of this Array entity.
Returns:Type Description string The name of this Array entity Example
Back to Topvar arr = scenario.getArray('INTEGER_ARRAY'); arr.getName();
- getValue ( key ) → {PrimitiveType|null|undefined}
-
Gets the value of the element with the given indices.
Parameters:
Name Type Description key Array.<PrimitiveType> | PrimitiveType The indices of the array element Returns:Type Description PrimitiveType | null | undefined The value for this key (which can be null), or undefined if the array does not contain the key Example
Back to Toparray.getValue(["x1", 2, false]);
- size ( ) → {number}
-
The size of the array.
Returns:Type Description number The size of the array Example
Back to Toparray.size();
- toObjectArray ( sortKeys ) → {Array.<Object.<{key: (Array.<PrimitiveType>|PrimitiveType), value: PrimitiveType}>>}
-
Converts the Insight Array into an array of plain javascript objects.
Parameters:
Name Type Argument Default Description sortKeys boolean optional false Whether to sort array keys. This will use any set comparators assigned to index sets, otherwise it will fallback to default sorting based on index set data type. Warning, this is likely to reduce performance on large arrays. Returns:Type Description Array.<Object.<{key: (Array.<PrimitiveType>|PrimitiveType), value: PrimitiveType}>> An array of items. Example
Back to Topvar arr = scenario.getArray('ARRAY1'); arr.toObjectArray(); // e.g. [{key: ['x1', 'y1'], value: '1,1'}, {key: ['x1', 'y2'], value: '1,2'}]
© 2001-2024 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.