GetItemWithIndex Method (PIAliasList2 object)

             

 

Retrieves a PIAlias from the collection by name or by position in the collection. The position of the item in the collection is returned along with the item.

 

Syntax

object.GetItemWithIndex varIndex, position

The Item property syntax has these parts:

Part

Description

object

An object expression that evaluates to a PIAliasList2 object.

varIndex

A VARIANT that specifies a member of the collection, as described in Settings.

position The numerical position of the item in the collection.

 

Settings

The settings for index are:

Setting

Description (collections implementing setting)

position number

Specifies the position number of a member of the collection. Must range from 1 to the value of the collection's Count property. (See Remarks for specifics.).

string

Specifies a collection member by name. Must be equal to the Name property of a member of the collection. (See Remarks for specifics.).

 

Remarks

The position number of a collection member may change as new members are added.

 

PIAliasList2 collections allow PIAlias's with the same name to be inserted. Even PIAlias's with the same name from different values of the same PIModule are allowed. The items are sorted by the following string (only used internally):

    PIAliasName\ParentModuleUniqueID\ParentModuleEffectiveDateUTCSeconds

 

where:

    PIAliasName – The Name property of the PIAlias object.

    ParentModuleUniqueID – The UniqueID of the parent PIModule expressed as a string

    ParentModuleEffectiveDateUTCSeconds – The EffectiveDate of the parent PIModule expressed as a string of the UTCSeconds of that PITime

 

This means that PIAlias's in the list are in name order regardless of which PIModule they are associated with. For PIAlias's of different values of a PIModule (same UniqueID), the are stored in the order of the EffecitveDate (low to high UTC seconds) of their parent PIModule's value.

 

If you use the GetItemWithAlias method of PIAliasList2, you can get the index number of an item retrieved by name. You can then increment that index to find other items with the same PIAlias.Name.

 

 

Enabling Operational Intelligence