beautypg.com

Objgetarray, Jgetarray, Getarray, ob – Visara Master Console Center Scripting Guide User Manual

Page 153

background image

Chapter 5 Script Commands

Scripting Guide

153

OBJGETARRAY

Syntax:

OBJGETARRAY( %ObjID, $AssocArray) ==> %ErrCode

Description:

Populates an associative string array with the current field values from

an object.

Action:

The current values in the fields for the object specified by ObjID are

populated into an associative array. The index values of the associative
array are the field names for the object.

Parameters:

%ObjID. Numeric expression. The object id. The ID assigned to the

object from which to get the values. Refer to Object ID on page 26 for
more information.
$AssocArray. Associative string array. The array to populate with the
current values from the object. Integer values are converted to strings.

Returns:

A numeric value representing the status of the operation. If %ErrCode is

ERROR, the ERRORNUM() function returns a value as follows:
Manifest Constant

Description

Err_None

No

error

has

occurred.

Err_Obj_InvalidId

%ObjID

does

not contain a valid object id.

Notes:

1. Refer to the description of the VAL() command for string to numeric

conversions.

2. The associative string array is cleared before being populated with the

field values. Refer to the description of ARESET() for more

information.

3. The TaskName field is fixed and cannot be changed by a script.

Consequently, OBJGETARRAY cannot return its value.

4. OBJGETARRAY() is more efficient than OBJGET() when

retrieving more than 25% of the fields of an object.

Example:

$MyObject := “MyCPU:MyOS:cron”
%MyID := OBJID( SW, $MyObject )

%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)


OUTPUT:
Current Status is: UNKNOWN
Desired Status is: UNKNOWN
Group Status is: NONE

See Also:

OBJEXEC, OBJGET, OBJID, OBJIDARRAY, OBJSET, OBJSETARRAY