ModifyAttributes Method (PIProperty object)

             

 

The ModifyAttributes method changes the values of the passed attributes in the corresponding object on the Server.  The method provides a more efficient way to make multiple modifications than setting the attributes individually. Desired modifications are specified in the passed NamedValues collection where the each name is a property name and the value contains the new property value.

 

Syntax

object.ModifyAttributes nvsAttributes, hnvsErrors

  

The ModifyAttributes method syntax has these parts:

Part

Description

object

An object expression that evaluates to a PIProperty.

nvsAttributes

NamedValues collection of attribute names and new values used to modify the object.

hnvsErrors

NamedValues collection of errors returned if there are problems.

 

Remarks

For a PIProperty object, ModifyAttributes can modify both the object itself and add properties to the subproperty hierarchy below the object. This gives you a way to add a complicated property hierarchy with one call. This is much more efficient than adding properties one at a time and then editing them.

 

Trappable Errors

In addition to generic errors (such as Out of Memory), the following errors may occur:

Error

Description

pseMODIFYATTRIBUTES

There was an error with ModifyAttributes. Check the errors (hnvsErrors) collection

 

Errors Collection Errors

Here are some of the errors that can be returned in the errors collection (hnvsErrors). The name of the NamedValue in the collection is the attribute name passed. The value is the error code:

Error

Description

pseATTRIBUTENOTVALID

The attribute name passed wasn't valid.

pseINVALIDNAME

Name of the object is invalid.

  

Example

There is a complete example of how to use ModifyAttributes for a PIModule in the PI-SDK area of the http://techsupport.osisoft.com web site. This example also shows how to add a PIProperty hierarchy.

 

Enabling Operational Intelligence