AFAttribute Class
- Last UpdatedNov 18, 2025
- 18 minute read
- PI System
- AF SDK 2024 R2
- Developer

Inheritance Hierarchy
Namespace: OSIsoft.AF.Asset
Assembly: OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 3.1.1.1182
Syntax
[SerializableAttribute] public sealed class AFAttribute : AFObject, IAFAttribute, IAFTimeSource, IComparable<AFAttribute>
<SerializableAttribute> Public NotInheritable Class AFAttribute Inherits AFObject Implements IAFAttribute, IAFTimeSource, IComparable(Of AFAttribute) Dim instance As AFAttribute
[SerializableAttribute] public ref class AFAttribute sealed : public AFObject, IAFAttribute, IAFTimeSource, IComparable<AFAttribute^>
[<SealedAttribute>] [<SerializableAttribute>] type AFAttribute = class inherit AFObject interface IAFAttribute interface IAFTimeSource interface IComparable<AFAttribute> end
The AFAttribute type exposes the following members.
Constructors
| Name | Description | |
|---|---|---|
| AFAttribute(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.
| |
| AFAttribute(AFDatabase) |
Dynamically create an AFAttribute that is not associated
with an AFBaseElement and does not have a
AFDataReference configured.
| |
| AFAttribute(PIPoint) |
Dynamically create an AFAttribute that is not associated
with an AFBaseElement and has an AFDataReference
configured from the specified PIPoint.
| |
| AFAttribute(AFDatabase, String) |
Dynamically create an AFAttribute that is not associated
with an AFBaseElement and has an AFDataReference
configured from the specified dynamic attribute path.
|
Properties
| Name | Description | |
|---|---|---|
| Attributes |
This is a collection of child attributes that have been added to this attribute.
| |
| Categories |
This is a user-defined collection of categories for the object that can be used for
querying and/or reporting purposes.
| |
| CategoriesString |
This read-only property returns the list of categories in a string separated by semicolons.
| |
| ConfigString |
This property returns the current configuration of the attribute's data reference
as a string suitable for displaying to an end-user.
| |
| Data |
This read-only property returns the data access object for this AFAttribute.
| |
| Database |
This read-only property returns the AFDatabase where this object is defined.
| |
| DataReference |
The instance of the data reference used by the AFAttribute to
get and set values in a data source.
| |
| DataReferencePlugIn |
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.
| |
| DefaultUOM |
This property defines the default unit of measure (UOM) for the attribute's value.
| |
| Description |
Read/write property that provides a more detailed description of the object.
| |
| DisplayDigits |
The DisplayDigits property controls the format of numeric values on displays and in reports.
| |
| DisplayUOM |
This property returns the display unit of measure (UOM) for the attribute's value.
| |
| Element |
This read-only property returns the AFBaseElement that owns
this AFAttribute.
| |
| HasChildren |
This read-only property returns if the attribute has child attributes.
| |
| ID |
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.) | |
| Identity |
This read-only property contains identity of the object.
(Inherited from AFObject.) | |
| IsAnyDataMethodSupported |
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.
| |
| IsConfigurationItem |
This property determines whether this attribute is a configuration item
for the associated element.
| |
| IsDataReferenceDefinedByTemplate |
This read-only property indicates if this attribute's
DataReference and ConfigString
are fully defined by the AFElementTemplate.
| |
| IsDeleted |
This read-only property indicates whether the object has been deleted.
(Inherited from AFObject.) | |
| IsDynamic |
This property indicates if this attribute is dynamic.
| |
| IsExcluded |
This property determines whether this attribute is excluded for the associated element.
| |
| IsHidden |
This property determines whether this attribute is hidden in client applications.
| |
| IsManualDataEntry |
This property determines whether this attribute is used for manual data entry.
| |
| Name |
This property defines the name that identifies the object.
| |
| Parent |
This read-only property returns the AFAttribute that is the parent
of this attribute.
| |
| PIPoint |
The PIPoint associated with this attribute.
| |
| PISystem |
This read-only property allows access to the PISystem associated with this
object.
(Inherited from AFObject.) | |
| RawPIPoint | Obsolete.
Returns the raw PISDK.PIPoint associated with this attribute.
| |
| ServerTime |
Gets the current time of the server associated with this AFAttribute.
| |
| ServerTimeSource |
Gets the server time source associated with this AFAttribute.
| |
| ServerTimeZone |
Gets the current time zone of the server associated with this AFAttribute.
| |
| SourceUOM |
This property specifies the source unit of measure (UOM) for the attribute's value.
| |
| Step |
This property returns if the attribute's value is stepped.
| |
| SupportedContexts |
This read-only property specifies which of the data reference contexts are
supported when getting and/or setting values.
| |
| SupportedDataMethods |
This read-only property specifies which of the data methods are supported
by the data reference.
| |
| SupportedMethods |
This read-only property specifies which of the data reference methods for
getting and/or setting values are supported.
| |
| Template |
This read-only property returns the AFAttributeTemplate
that was used to create this AFAttribute.
| |
| Trait |
This property specifies the attribute trait for this attribute.
| |
| Type |
This property specifies the type of the attribute's value.
| |
| TypeQualifier |
Specifies a further qualification of the types of values available for this attribute.
| |
| UniqueID |
Read-only property that provides the object's ID as a String.
(Inherited from AFObject.) |
Methods
| Name | Description | |
|---|---|---|
| CompareTo(Object) |
Compares this instance with a specified Object.
(Inherited from AFObject.) | |
| CompareTo(AFObject) |
Compares this instance with a specified AFObject.
(Inherited from AFObject.) | |
| Equals(Object) |
Determines whether the specified Object is equal to the current object.
(Inherited from AFObject.) | |
| Equals(AFObject) |
Indicates whether the current object is equal to another object of the same type.
(Inherited from AFObject.) | |
| FindAttribute(String, AFObject) |
Retrieves the AFAttribute object identified by the path string relative to
the specified object.
| |
| FindAttribute(AFBaseElement, AFAttributeTemplate) |
Retrieves the AFAttribute object created from the specified
AFAttributeTemplate.
| |
| FindAttribute(AFBaseElement, Guid) |
Retrieves the AFAttribute with the specified unique identifier.
| |
| FindAttributes |
Finds a list of AFAttribute objects identified by the path, relative from the specified object.
| |
| FindAttributesByPath(IEnumerableString, AFObject) |
Retrieves the AFAttribute objects identified by the path strings as keyed results.
| |
| FindAttributesByPath(IEnumerableString, AFObject, IDictionaryString, String) |
Retrieves the AFAttribute objects identified by the path strings as a list.
| |
| FindCaseAttributes(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.
| |
| FindCaseAttributes(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.
| |
| FindElementAttributes(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.
| |
| FindElementAttributes(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.
| |
| FindElementAttributes(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.
| |
| FindElementAttributes(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.
| |
| FindEventFrameAttributes(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.
| |
| FindEventFrameAttributes(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.
| |
| FindNotificationAttributes(AFDatabase, String, AFCategory, AFElementTemplate, String, AFCategory, TypeCode, AFSortField, AFSortOrder, Int32) |
Retrieves a non-paged collection of AFNotificationAFAttribute
objects matching the specified filters.
| |
| FindNotificationAttributes(AFDatabase, String, String, AFCategory, AFElementTemplate, String, String, AFCategory, TypeCode, AFSortField, AFSortOrder, Int32) |
Retrieves a non-paged collection of AFNotificationAFAttribute
objects matching the specified filters.
| |
| FindTransferAttributes(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.
| |
| FindTransferAttributes(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.
| |
| GetAttributeByTrait |
Retrieves the child AFAttribute with the specified AFAttributeTrait.
| |
| GetAttributesByTrait |
Retrieves a list of child AFAttribute objects identified by the specified list of attribute traits.
| |
| GetHashCode |
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.) | |
| GetPath |
Returns the full path to the object, using just the names.
(Inherited from AFObject.) | |
| GetPath(AFObject) |
Returns the path to the object relative from another object.
(Inherited from AFObject.) | |
| GetPath(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.) | |
| GetPaths |
Get all the relative paths to this AFAttribute.
| |
| GetType | Gets the Type of the current instance. (Inherited from Object.) | |
| GetValue |
This method gets the value for an attribute based upon the data reference configuration
in the units of the DefaultUOM for the attribute.
| |
| GetValue(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.
| |
| GetValue(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.
| |
| GetValue(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.
| |
| GetValue(UOM) |
This method gets the value for an attribute based upon the data reference configuration
in the specified units-of-measure.
| |
| GetValue(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.
| |
| GetValue(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.
| |
| GetValue(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.
| |
| GetValue(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.
| |
| GetValues(AFAnalysis, IListAFCase, UOM) |
This method gets a collection of AFValue objects for an attribute
in each of the cases.
| |
| GetValues(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.
| |
| GetValues(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.
| |
| IsSupportedDataMethod |
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.
| |
| Persist |
This method returns the persistence string for the object.
(Overrides AFObjectPersist.) | |
| RawPIPointPath |
Returns the path to the PIPoint that the attribute represents.
| |
| ResetToTemplate |
This method will reset the AFAttribute back to its template default values.
| |
| SetConfigStrings |
Set the ConfigString values for the specified list of attributes.
| |
| SetValue(AFValue) |
This method sets the value for an attribute based upon the data reference configuration
using the specified AFValue object.
| |
| SetValue(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.
| |
| SetValue(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.
| |
| SetValue(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.
| |
| SetValue(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.
| |
| SetValue(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.
| |
| ToString |
Returns a String that represents the current object.
(Inherited from AFObject.) |
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); // An example of a valid configuration string: // "\\%Server%\sinusoid;ptclassname=classic;pointtype=Float32;pointsource=R;descriptor=""12 Hour Sine Wave"";location2=2;location4=1" myAttribute.ConfigString = myConfigString; // 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); }
' This example demonstrates how to create an attribute for an ' element and display information about it. ' Get the Database Dim myPISystems As New PISystems Dim myPISystem As PISystem = myPISystems.DefaultPISystem Dim myDB As AFDatabase = myPISystem.Databases.DefaultDatabase ' Create An Element Dim myElement As AFElement = myDB.Elements.Add("MyElement*") ' Create an Attribute Dim CurAttribute As AFAttribute = myElement.Attributes.Add("MyAttribute") CurAttribute.Description = "Attribute for MyElement" CurAttribute.DefaultUOM = myPISystem.UOMDatabase.UOMs("Kelvin") CurAttribute.DataReferencePlugIn = AFDataReference.GetPIPointDataReference(myPISystem) ' An example of a valid configuration string ' "\\%Server%\sinusoid;ptclassname=classic;pointtype=Float32;pointsource=R;descriptor=""12 Hour Sine Wave"";location2=2;location4=1" CurAttribute.ConfigString = myConfigString 'Get Value Dim myValue As AFValue = CurAttribute.GetValue(myPISystem.UOMDatabase.UOMs("degree Celsius")) Console.WriteLine("Attribute Template Value = {0} {1}", myValue.Value, myValue.UOM) ' Display Attribute Information For Each 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) Next CurAttribute
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.