Item Property (StateSet collection)

               

 

This default property of the StateSet collection, when given a numeric or string index returns the corresponding DigitalState object.

Syntax

object[.Item]( index)

The Item property syntax has these parts:

Part

Description

object

An object expression that evaluates to a StateSet collection.

index

An expression that specifies a member of the collection, as described in Settings.

 

Settings

The settings for index are:

Setting

Description (collections implementing setting)

numeric

Specifies the 0-based offset of the DigitalState within the collection.  Unlike most, the StateSet collection uses 0-based offset for consistency with traditional access of PI digital states. 

string

Specifies a DigitalState by name. 

 

Remarks

The Item property is the default property of the collection, so these expressions have the same meaning:

MyColl.Item(3)

MyColl(3)

Trappable Errors

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

Error

Description

pseSTATENOTFOUND

The requested DigitalState does not exist in this set.

pseBADINDEXTYPE

The passed index was not a string or numeric.

Enabling Operational Intelligence