ModifyAttributes Method (PointAttributes collection)

                

 

This method modifies a number of attribute values in a single call. The desired changes are passed in a NamedValues collection. If any of the specified modifications fail, no changes are made. The nvErrors argument indicates which of the entries was in error and what type of error was encountered.

 

Syntax

object.ModifyAttributes AttributeList, nvErrors

The ModifyAttributes method syntax has these parts:

Part

Description

object

An object expression that evaluates to a PointAttributes object .

AttributeList

A NamedValues collection specifying the attribute names and the desired values to be changed.

nvErrors

A NamedValues collection containing the names and error codes of the attributes where errors were encountered.

 

Remarks

This call provides a more streamlined way to modify a number of PointAttribute values in a single call. The same effect can be achieved by accessing each attribute from the collection individually using the Item property of the collection, and modifying its value.

The collection’s ReadOnly property must be set to FALSE for this function to succeed.

The PI-SDK will coerce the data types of the NamedValue objects in the passed collection to those of the named attributes. This simplifies the call, allowing passing integer and real values as strings.

When the method returns, in most cases there will be an nvErrors collection though if the modification succeeded the collection will be empty. If no nvErrors collection was built the variable will be set to Nothing.

 

Trappable Errors

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

Error

Description

pseATTRIBSREADONLY

The PointAttributes collection is currently read-only.

pseCOLLECTIONPARENT

The parent of the current PointAttributes collection could not be determined.

pseNAMEDVALUESENUM

Unable to obtain an iterator for the passed NamedValues collection.

pseNAMEDVALUESNEXT

Unable to obtain an item from the passed NamedValues collection. The collection may have been empty.

pseNAMEDVALUESGET

Unable to retrieve a value from the passed NamedValues collection.

pseVARIANTTOPIVALUE

Trouble converting one of the values in the passed NamedValues collection to an equivalent PI value.

pseVARIANTTOTIMESTAMP

Trouble converting a value interpreted as a date/time in the passed NamedValues collection to an equivalent PI time.

pseATTRNAMETABLEADD

Problems adding an attribute passed in the NamedValues collection to an internal name table.

pseERRORARRAY

Problems creating or accessing the array of error codes.

pseATTREDITSERVER

Unable to update the server with the passed attributes.

psePOINTATTRNOTFOUND

One or more of the passed attribute names is not a member of the PointAttributes collection.

pseATTRTYPECOERCIONFAILED

Unable to coerce one of the passed attributes to the attribute type.

Enabling Operational Intelligence