Item Property (PISDK objects)

               

 

The Item property retrieves a member from a collection by the passed index.  Different collections support different index options (see below), for example, name, position in the collection, unique identifier. The property is Read-Only.

Syntax

object[.Item](index)

The Item property syntax has these parts:

Part Description

object

An object expression that evaluates to an object in the Applies To list.

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)
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.).

(CollectiveList, LogMessages, LogMessagesEx, MTPIProperties, NamedValues, OpenServers, PIAliases, PIAliasList, PIBatches, PIBatchList, PICampaignList, PIHeadings, PIHeadingSets, PIModuleList, PIModules, PIModuleTemplates, PIModuleVersionList, PIProperties, PIPropertyList, PISubBatches, PITransferRecordList, PIUnitBatches, PIUnitBatchList, PIValues, PointList, PointValues, StateSets, StateSet)

name Specifies a collection member as a string by name. Typically this is equal to the Name property of a member of the collection. (See Remarks for specifics.).

(All collections except LogMessages, LogMessagesEx, PIValues. Note for a PointList the name index is based on both the server and the tag with the syntax \\servername\tagname)

identification number Specifies an identifier for the collection member formatted as a string containing a question mark ("?") followed by the identifier.

(PIPoints - the identifier is the pointID, Servers - the identifier is the ServerID)

UID

Specifies a unique identifier for the collection member

(PIBatches, PIBatchList, PICampaignList, PIHeadings, PIHeadingSets, PIModuleList, PIModules, PIModuleTemplates, PISubBatches, PITransferRecordList, PIUnitBatches, PIUnitBatchList )

TimeStamp Specifies a timestamp for the collection member. The timestamp may be a PITime, DATE, String, or numeric. Interpretation of DATE, strings and numerics is consistent with PITime's interpretation.

(PIModuleVersionList)

Pathname A string that specifies the relative pathname of a PIModule.

 

\modulename

\modulename\modulename

\modulename\modulename\...\modulename
 

NOTES:

A leading backslash (\) is optional, but will speed up retrieval since backslashes are not allowed in module names.

 

A PIModule can have more than one parent and thus more than one pathname. No pathname is preferred by the database over any other one.

The pathname of a PIModule can be different at different times in history. The module that is found (or not found) depends on the QueryDate of the object (PIModule or PIModuleDB) that the PIModules collection was obtained from. The particular value of the PIModule returned also depends on the same QueryDate setting. This is one of the key features of the PI Module Database.

 

Remarks

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

MyColl.Item(3)

MyColl(3)

In some collections, the position number of a collection member may change as new members are added.

Collections may not support item lookup by all setting methods. The preceding table indicates the collections supporting each index setting method.

In the PIBatches collection, the name will return the first occurrence for batches with identical names. The position number may be used to search through all batches in a collection.

In the StateSet collection, the item number is zero-based. This behavior agrees with the historic interpretation of DigitalState codes.

In the PointList, and the PointValues collection, the item string is equal to the PathName property, rather than the Name property, of the member. This is because the Name property does not uniquely identify a member of a PointList , which can contain points from several servers.

In the NamedValues collection, a string for the index will be coerced to a number if the name of a NamedValue item doesn't match. This can result in a error of

-2147220445 - pseOUTOFRANGE instead of the expected pseNAMENOTFOUND. It can also result in an item being returned even if the Name doesn't match.

 

 

 

Enabling Operational Intelligence