Assockeys, Assockeys, iconn – Visara Master Console Center Scripting Guide User Manual
Page 81

Chapter 5 Script Commands
Scripting Guide
81
ASSOCKEYS
Syntax:
ASSOCKEYS( AssocArray, $NormArray) ==> %RetVal
Description:
Populate a normal string array with the string index keys of an
associative array.
Action:
Each key of the associative array is placed in an element of the string
normal array. Each element in the string normal array will contain
one of the associative array’s keys.
Parameters:
AssocArray. Associative array variable. The associative array from
which to get the keys. May be either a string or an integer array.
$NormArray. Normal array variable. The array to populate with the
associative array’s keys.
Returns:
Integer. The number of items in the array. This value can be used for
loops or other structures to ensure the entire array is populated.
Notes:
The keys are not retrieved in any guaranteed order. However, if the
associative array is not changed between two instances of
ASSOCKEYS, ASSOCKEYS generates identical results. If a sorted
order is required, use the ASORT() command.
Example:
// Retrieve list of all CPU names from a room
$RoomName := ICONNAME()
AICONNAMES( $ArrCPU, CPU, $RoomName)
%Number := ASSOCKEYS( $ArrCPU, $CPUList)
%Index := 1
WHILE %Index <= %Number
$CPUName := $CPUList[ %Index]
//additional processing
%Index := %Index + 1
ENDWHILE
See Also: