Objsetarray, Jsetarray, Etarray – Visara Master Console Center Scripting Guide User Manual
Page 159
Chapter 5 Script Commands
Scripting Guide
159
OBJSETARRAY
Syntax:
OBJSETARRAY( %ObjID, $AssocArray) ==> %Success
Description:
Sets the field values for an object from an associative string array.
Action:
The current values in the fields for the object specified by ObjID are set
to the values in the associative array. The index values of the associative
array are the field names for the object (see Notes below).
Parameters:
%ObjID. Numeric expression. The ID assigned to the object for which
to set the values. Refer to Object ID on page 26.
$AssocArray. Associative string array. The array from which to set the
object’s current field values. Integer fields are converted from the string
array.
Returns:
A numeric value indicating the status of the operation. The following
table describes the error codes:
Manifest Constant
Description
ERR_NONE
No
error
ERROR
Error has occurred. No values set.
Notes:
1. Refer to the STR() command description for numeric to string
conversions.
2. Not all of the object’s field names must be specified. Only the fields
specified in the associative array are set, and the unspecified fields
remain unchanged.
3. OBJSETARRAY() is more efficient than OBJSET() when setting
more than 25% of the fields of an object.
Example:
$SetCurrent := "UP"
$SetDesired := "UP"
$SetGroup := "UNIX"
$MyObject := “MyCPU:MyOS:cron”
%MyID := OBJID( SW, $MyObject )
GOSUB *DoOBJGETARRAY
$SetArray["Current"] := $SetCurrent
$SetArray["Desired"] := $SetDesired
$SetArray["Group"] := $SetGroup
%ReturnCode := OBJSETARRAY( %MyID, $SetArray )
GOSUB *DoOBJGETARRAY
END
*DoOBJGETARRAY:
%ReturnCode := OBJGETARRAY( %MyID, $aAllStatus )
$ReturnCurrent := $aAllStatus["Current"]
$ReturnDesired := $aAllStatus["Desired"]
$ReturnGroup := $aAllStatus["Group"]
LOG(LOG_EXEC,"Current Status is: " + $ReturnCurrent,3)
LOG(LOG_EXEC, "Desired Status is: " $ReturnDesired,3)
LOG(LOG_EXEC, "Group Status is: " + $ReturnGroup, 3)