Click or drag to resize
OSIsoft, LLC

AFAttribute Class

The AFAttribute represents a single value that is used to represent a specific piece of information that is part of an AFBaseElement. An AFAttribute may also include child attributes.

Inheritance Hierarchy

Namespace:  OSIsoft.AF.Asset
Assembly:  OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 2.10.8.440
Syntax
[SerializableAttribute]
public sealed class AFAttribute : AFObject, 
	IAFAttribute, IAFTimeSource, IComparable<AFAttribute>

The AFAttribute type exposes the following members.

Constructors
  NameDescription
Public methodAFAttribute(String)
Dynamically create an AFAttribute that is not associated with an AFBaseElement or PISystem and has an AFDataReference configured from the specified dynamic attribute path.
Public methodAFAttribute(AFDatabase)
Dynamically create an AFAttribute that is not associated with an AFBaseElement and does not have a AFDataReference configured.
Public methodAFAttribute(PIPoint)
Dynamically create an AFAttribute that is not associated with an AFBaseElement and has an AFDataReference configured from the specified PIPoint.
Public methodAFAttribute(AFDatabase, String)
Dynamically create an AFAttribute that is not associated with an AFBaseElement and has an AFDataReference configured from the specified dynamic attribute path.
Top
Properties
  NameDescription
Public propertyAttributes
This is a collection of child attributes that have been added to this attribute.
Public propertyCategories
This is a user-defined collection of categories for the object that can be used for querying and/or reporting purposes.
Public propertyCategoriesString
This read-only property returns the list of categories in a string separated by semicolons.
Public propertyConfigString
This property returns the current configuration of the attribute's data reference as a string suitable for displaying to an end-user.
Public propertyData
This read-only property returns the data access object for this AFAttribute.
Public propertyDatabase
This read-only property returns the AFDatabase where this object is defined.
Public propertyDataReference
The instance of the data reference used by the AFAttribute to get and set values in a data source.
Public propertyDataReferencePlugIn
The data reference plugin property is used to specify which data reference will be used by the AFAttribute to retrieve and set values in a data source.
Public propertyDefaultUOM
This property defines the default unit of measure (UOM) for the attribute's value.
Public propertyDescription
Read/write property that provides a more detailed description of the object.
Public propertyDisplayDigits
The DisplayDigits property controls the format of numeric values on displays and in reports.
Public propertyCode exampleDisplayUOM
This property returns the display unit of measure (UOM) for the attribute's value.
Public propertyElement
This read-only property returns the AFBaseElement that owns this AFAttribute.
Public propertyHasChildren
This read-only property returns if the attribute has child attributes.
Public propertyID
Read-only property that provides a unique identifier for the object to be used for quick access that is not dependent upon the index.
(Inherited from AFObject.)
Public propertyIdentity
This read-only property contains identity of the object.
(Inherited from AFObject.)
Public propertyIsAnyDataMethodSupported
Returns if the attribute supports any AFDataMethods. If , data access calls to this AFAttribute can be made via the AFData instance returned by the Data property. If , data access should be performed via GetValue Overload or GetValues Overload.
Public propertyIsConfigurationItem
This property determines whether this attribute is a configuration item for the associated element.
Public propertyIsDataReferenceDefinedByTemplate
This read-only property indicates if this attribute's DataReference and ConfigString are fully defined by the AFElementTemplate.
Public propertyIsDeleted
This read-only property indicates whether the object has been deleted.
(Inherited from AFObject.)
Public propertyIsDynamic
This property indicates if this attribute is dynamic.
Public propertyIsExcluded
This property determines whether this attribute is excluded for the associated element.
Public propertyIsHidden
This property determines whether this attribute is hidden in client applications.
Public propertyIsManualDataEntry
This property determines whether this attribute is used for manual data entry.
Public propertyName
This property defines the name that identifies the object.
Public propertyParent
This read-only property returns the AFAttribute that is the parent of this attribute.
Public propertyPIPoint
The PIPoint associated with this attribute.
Public propertyPISystem
This read-only property allows access to the PISystem associated with this object.
(Inherited from AFObject.)
Public propertyRawPIPoint Obsolete.
Returns the raw PISDK.PIPoint associated with this attribute.
Public propertyServerTime
Gets the current time of the server associated with this AFAttribute.
Public propertyServerTimeSource
Gets the server time source associated with this AFAttribute.
Public propertyServerTimeZone
Gets the current time zone of the server associated with this AFAttribute.
Public propertySourceUOM
This property specifies the source unit of measure (UOM) for the attribute's value.
Public propertyStep
This property returns if the attribute's value is stepped.
Public propertySupportedContexts
This read-only property specifies which of the data reference contexts are supported when getting and/or setting values.
Public propertySupportedDataMethods
This read-only property specifies which of the data methods are supported by the data reference.
Public propertySupportedMethods
This read-only property specifies which of the data reference methods for getting and/or setting values are supported.
Public propertyTemplate
This read-only property returns the AFAttributeTemplate that was used to create this AFAttribute.
Public propertyTrait
This property specifies the attribute trait for this attribute.
Public propertyType
This property specifies the type of the attribute's value.
Public propertyTypeQualifier
Specifies a further qualification of the types of values available for this attribute.
Public propertyUniqueID
Read-only property that provides the object's ID as a String.
(Inherited from AFObject.)
Top
Methods
  NameDescription
Public methodCompareTo(Object)
Compares this instance with a specified Object.
(Inherited from AFObject.)
Public methodCompareTo(AFObject)
Compares this instance with a specified AFObject.
(Inherited from AFObject.)
Public methodEquals(Object)
Determines whether the specified Object is equal to the current object.
(Inherited from AFObject.)
Public methodEquals(AFObject)
Indicates whether the current object is equal to another object of the same type.
(Inherited from AFObject.)
Public methodStatic memberFindAttribute(String, AFObject)
Retrieves the AFAttribute object identified by the path string relative to the specified object.
Public methodStatic memberFindAttribute(AFBaseElement, AFAttributeTemplate)
Retrieves the AFAttribute object created from the specified AFAttributeTemplate.
Public methodStatic memberFindAttribute(AFBaseElement, Guid)
Retrieves the AFAttribute with the specified unique identifier.
Public methodStatic memberFindAttributes
Finds a list of AFAttribute objects identified by the path, relative from the specified object.
Public methodStatic memberFindAttributesByPath(IEnumerableString, AFObject)
Retrieves the AFAttribute objects identified by the path strings as keyed results.
Public methodStatic memberFindAttributesByPath(IEnumerableString, AFObject, IDictionaryString, String)
Retrieves the AFAttribute objects identified by the path strings as a list.
Public methodStatic memberFindCaseAttributes(AFAnalysis, AFSearchMode, Object, Object, String, AFCategory, AFElementTemplate, String, AFCategory, TypeCode, AFSortField, AFSortOrder, Int32)
Retrieves a non-paged collection of AFCaseAFAttribute objects matching the specified filters.
Public methodStatic memberFindCaseAttributes(AFAnalysis, AFSearchMode, Object, Object, String, String, AFCategory, AFElementTemplate, String, String, AFCategory, TypeCode, AFSortField, AFSortOrder, Int32)
Retrieves a non-paged collection of AFCaseAFAttribute objects matching the specified filters.
Public methodStatic memberFindElementAttributes(AFDatabase, AFElement, String, AFCategory, AFElementTemplate, AFElementType, String, AFCategory, TypeCode, Boolean, AFSortField, AFSortOrder, Int32)
Retrieves a non-paged collection of AFElementAFAttribute objects matching the specified filters.
Public methodStatic memberFindElementAttributes(AFDatabase, AFElement, String, AFCategory, AFElementTemplate, AFElementType, String, AFCategory, TypeCode, Boolean, AFSortField, AFSortOrder, Int32, Int32, Int32)
Retrieves a paged collection of AFElementAFAttribute objects matching the specified filters.
Public methodStatic memberFindElementAttributes(AFDatabase, AFElement, String, String, AFCategory, AFElementTemplate, AFElementType, String, String, AFCategory, TypeCode, Boolean, AFSortField, AFSortOrder, Int32)
Retrieves a non-paged collection of AFElementAFAttribute objects matching the specified filters.
Public methodStatic memberFindElementAttributes(AFDatabase, AFElement, String, String, AFCategory, AFElementTemplate, AFElementType, String, String, AFCategory, TypeCode, Boolean, AFSortField, AFSortOrder, Int32, Int32, Int32)
Retrieves a paged collection of AFElementAFAttribute objects matching the specified filters.
Public methodStatic memberFindEventFrameAttributes(AFDatabase, AFSearchMode, Object, Object, AFEventFrame, String, String, AFCategory, AFElementTemplate, AFDurationQuery, String, AFCategory, TypeCode, Boolean, AFSortField, AFSortOrder, Int32, Int32)
Retrieves a paged collection of AFEventFrameAFAttribute objects matching the specified filters.
Public methodStatic memberFindEventFrameAttributes(AFDatabase, AFSearchMode, Object, Object, AFEventFrame, String, String, String, AFCategory, AFElementTemplate, AFDurationQuery, String, String, AFCategory, TypeCode, Boolean, AFSortField, AFSortOrder, Int32, Int32)
Retrieves a paged collection of AFEventFrameAFAttribute objects matching the specified filters.
Public methodStatic memberFindNotificationAttributes(AFDatabase, String, AFCategory, AFElementTemplate, String, AFCategory, TypeCode, AFSortField, AFSortOrder, Int32)
Retrieves a non-paged collection of AFNotificationAFAttribute objects matching the specified filters.
Public methodStatic memberFindNotificationAttributes(AFDatabase, String, String, AFCategory, AFElementTemplate, String, String, AFCategory, TypeCode, AFSortField, AFSortOrder, Int32)
Retrieves a non-paged collection of AFNotificationAFAttribute objects matching the specified filters.
Public methodStatic memberFindTransferAttributes(AFDatabase, AFSearchMode, Object, Object, String, AFBaseElement, AFBaseElement, AFCategory, AFElementTemplate, String, AFCategory, TypeCode, AFSortField, AFSortOrder, Int32)
Retrieves a non-paged collection of AFTransferAFAttribute objects matching the specified filters.
Public methodStatic memberFindTransferAttributes(AFDatabase, AFSearchMode, Object, Object, String, String, AFBaseElement, AFBaseElement, AFCategory, AFElementTemplate, String, String, AFCategory, TypeCode, AFSortField, AFSortOrder, Int32)
Retrieves a non-paged collection of AFTransferAFAttribute objects matching the specified filters.
Public methodGetAttributeByTrait
Retrieves the child AFAttribute with the specified AFAttributeTrait.
Public methodGetAttributesByTrait
Retrieves a list of child AFAttribute objects identified by the specified list of attribute traits.
Public methodGetHashCode
Gets the hash code for this instance of the object which is suitable for use in hashing algorithms and data structures like a hash table.
(Inherited from AFObject.)
Public methodGetPath
Returns the full path to the object, using just the names.
(Inherited from AFObject.)
Public methodGetPath(AFObject)
Returns the path to the object relative from another object.
(Inherited from AFObject.)
Public methodGetPath(AFEncodeType, AFObject)
Returns the path to the object relative from another object, using the name and/or id as specified by encodeType.
(Inherited from AFObject.)
Public methodGetPaths
Get all the relative paths to this AFAttribute.
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodGetValue
This method gets the value for an attribute based upon the data reference configuration in the units of the DefaultUOM for the attribute.
Public methodGetValue(AFCase)
This method gets the value for an attribute based upon the data reference configuration and the specified AFCase context in the units of the DefaultUOM for the attribute.
Public methodGetValue(AFTime)
This method gets the value for an attribute based upon the data reference configuration and the specified AFTime context in the units of the DefaultUOM for the attribute.
Public methodGetValue(AFTimeRange)
This method gets the value for an attribute based upon the data reference configuration and the specified AFTimeRange context in the units of the DefaultUOM for the attribute.
Public methodGetValue(UOM)
This method gets the value for an attribute based upon the data reference configuration in the specified units-of-measure.
Public methodGetValue(AFCase, UOM)
This method gets the value for an attribute based upon the data reference configuration and the specified AFCase context in the specified units-of-measure.
Public methodGetValue(AFTime, UOM)
This method gets the value for an attribute based upon the data reference configuration and the specified AFTime context in the specified units-of-measure.
Public methodGetValue(AFTimeRange, UOM)
This method gets the value for an attribute based upon the data reference configuration and the specified AFTimeRange context in the specified units-of-measure.
Public methodGetValue(Object, Object, UOM) Obsolete.
This method gets the value for an attribute based upon the data reference configuration and the specified AFCase context in the specified units-of-measure.
Public methodGetValues(AFAnalysis, IListAFCase, UOM)
This method gets a collection of AFValue objects for an attribute in each of the cases.
Public methodGetValues(AFTimeRange, Int32, UOM)
This method gets a collection of AFValue objects for an attribute based upon the data reference configuration within the specified AFTimeRange context.
Public methodGetValues(Object, AFTimeRange, Int32, UOM) Obsolete.
This method gets a collection of AFValue objects for an attribute based upon the data reference configuration within the specified AFTimeRange context.
Public methodIsSupportedDataMethod
Tests if the attribute supports the specified set of AFDataMethods. The result of this method is consistent with the SupportedDataMethods property, but this method allows omission of testing unnecessary modes.
Public methodPersist
This method returns the persistence string for the object.
(Overrides AFObjectPersist.)
Public methodRawPIPointPath
Returns the path to the PIPoint that the attribute represents.
Public methodResetToTemplate
This method will reset the AFAttribute back to its template default values.
Public methodStatic memberSetConfigStrings
Set the ConfigString values for the specified list of attributes.
Public methodSetValue(AFValue)
This method sets the value for an attribute based upon the data reference configuration using the specified AFValue object.
Public methodSetValue(Object, UOM)
This method sets the value for an attribute based upon the data reference configuration with a default timestamp and the specified unit-of-measure.
Public methodSetValue(AFCase, AFValue)
This method sets the value for an attribute into the result set of the specified caseContext using the specified AFValue object. Values written into the case can be subsequently output to associated data references by invoking AFCase.Publish method.
Public methodSetValue(Object, Object, UOM) Obsolete.
This method sets the value for an attribute based upon the data reference configuration with a default timestamp and the specified unit-of-measure.
Public methodSetValue(AFCase, AFValue, UOM) Obsolete.
This method sets the value for an attribute based into the result set of the specified AFCase context using the specified AFValue object. Values written into the case can be subsequently output to associated data references by invoking AFCase.Publish method.
Public methodSetValue(AFCase, Object, UOM)
This method sets the value for an attribute into the result set of the specified caseContext with a default timestamp and the specified unit-of-measure. Values written into the case can be subsequently output to associated data references by invoking AFCase.Publish method.
Public methodToString
Returns a String that represents the current object.
(Inherited from AFObject.)
Top
Remarks

An attribute is obtained from the AFAttributes collection of either the owning Element, or, within a hierarchy of attributes from the Parent attribute.

An attribute may be defined by an AFAttributeTemplate when the owning element is created from an AFElementTemplate. When defined by a template, the following properties of the attribute may not be modified: Categories, Description, DefaultUOM, IsConfigurationItem, Name, Type, and TypeQualifier. The following properties of an attribute created from a template may be overwritten: DataReferencePlugIn and ConfigString. Once overwritten, changes in the template's corresponding property will not be reflected into this attribute.

Depending upon the setting of the IsConfigurationItem property, an attribute can be either a configuration item or a runtime item. A configuration item indicates that a change in the value of the attribute indicates a change to the owning element. Thus, a change to a configuration item's value will not be written to the database until the owning element is checked into the server. An example of a configuration item is the height of a tank. A runtime item indicates that a change in the value occurs normally and does not indicate a change or revision modification to the owning element. Thus, a change to a runtime item's value will be written to the server immediately, unless it is written within the context of a case, which delays the write until the case is published. An example of a runtime item is the level of a tank. Most attributes tied to PI Points are runtime items.

The Data Reference defines how the attribute value is read and written. Attributes tied to PI Points will typically use the PI Point Data Reference. The PI Point Data Reference also allows different retrieval and summary mechanisms of PI to be defined on a per attribute basis.

Examples
// This example demonstrates how to create an attribute for an
// element and display information about it.

// Get the Database
PISystems myPISystems = new PISystems();
PISystem myPISystem = myPISystems.DefaultPISystem;
AFDatabase myDB = myPISystem.Databases.DefaultDatabase;

// Create an Element
AFElement myElement = myDB.Elements.Add("MyElement");

// Create an Attribute
AFAttribute myAttribute = myElement.Attributes.Add("MyAttribute");
myAttribute.Description = "Attribute for MyElement";
myAttribute.DefaultUOM = myPISystem.UOMDatabase.UOMs["kelvin"];
myAttribute.DataReferencePlugIn = AFDataReference.GetPIPointDataReference(myPISystem);
myAttribute.ConfigString = @"\\%Server%\sinusoid";

// Get Value
AFValue myValue = myAttribute.GetValue(myPISystem.UOMDatabase.UOMs["degree Celsius"]);
Console.WriteLine("Attribute Template Value = {0} {1}", myValue.Value, myValue.UOM);

// Display Attribute Information
foreach (AFAttribute CurAttribute in myElement.Attributes)
{
    Console.WriteLine("Name of Attribute = {0}", CurAttribute.Name);
    Console.WriteLine("Description = {0}", CurAttribute.Description);
    Console.WriteLine("Default UOM = {0}", CurAttribute.DefaultUOM.Name);
    Console.WriteLine("DataReference = {0}", CurAttribute.DataReference.Name);
    Console.WriteLine("ConfigString = {0}", CurAttribute.ConfigString);
}
Version Information

AFSDK

Supported in: 2.10.5, 2.10, 2.9.5, 2.9, 2.8.5, 2.8, 2.7.5, 2.7, 2.6, 2.5, 2.4
See Also
Enabling Operational Intelligence