ModifyAttributes Method (PIModule object)

             

 

The ModifyAttributes method changes the values of the passed attributes in the corresponding object on the Server.  The method provides a more efficient method to make multiple modifications then 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 PIModule.

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 PIModule object, ModifyAttributes can modify both the object itself and add modules to the submodule hierarchy below the object. This gives you a way to add a complicated module hierarchy with one call. This is much more efficient than adding modules 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.

psePIHEADINGNOTFOUND

The PIHeading that was being set wasn't found.

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.

Enabling Operational Intelligence