GetSelectedAttributes Method (PointAttributes collection)



Given a NamedValues collection of desired attributes this method returns a NamedValues collection containing the specified attributes and their values from a PointAttributes collection.



object.GetSelectedAttributes Selections

The GetSelectedAttributes method syntax has these parts:




An object expression that evaluates to a PointAttributes collection.


A NamedValues collection whose member’s names identify which attributes are desired. Although a value must be specified for each name when creating the collection, the value is ignored by the GetSelectedAttributes method.



The NamedValues collection returned by this method may be used as is or modified and passed to other PI-SDK methods that use NamedValues collections as arguments to manipulate PointAttributes, for example, PointAttributes.ModifyAttributes. The NamedValues collections may also be used for temporary storage and as arguments to functions designed to handle lists of named attribute sets.

If some of the passed attribute names are not found the method will return an error and the returned NamedValues collection is NULL.

Calling GetSelectedAttributes initially with a set of desired attributes before a.) accessing a particular attribute, b.) iterating through all possible attributes, or c.) retrieving the count of the PointAttributes collection, can reduce the amount of data the PI-SDK caches internally. When used in this way, the call signals to the PI-SDK that only a subset of the attributes is needed. Subsequent calls to retrieve specific attributes will succeed whether or not they were in this originally requested set and such requests are added to the list of "required" attributes the PI-SDK caches. Calls to iterate through all attributes, retrieve the total count, or calling GetSelectedAttributes passing a NULL for the argument, will all cancel this behavior. Note caching in the PI-SDK is strictly a performance characteristic and may change between versions.


Trappable Errors

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




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


Unable to retrieve point attributes from the server.


Unable to retrieve point class attributes from the server.


Unable to retrieve attribute data types from the server.


Unable to retrieve point attributes for an attribute set.


One or more of the requested attributes were not found.  None are returned.

Enabling Operational Intelligence