Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AF SDK Reference

AFAttribute Class

  • Last UpdatedNov 18, 2025
  • 18 minute read
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

SystemObject
  OSIsoft.AFAFObject
    OSIsoft.AF.AssetAFAttribute

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

  NameDescription
Public method
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.
Public method
AFAttribute(AFDatabase)
Dynamically create an AFAttribute that is not associated with an AFBaseElement and does not have a AFDataReference configured.
Public method
AFAttribute(PIPoint)
Dynamically create an AFAttribute that is not associated with an AFBaseElement and has an AFDataReference configured from the specified PIPoint.
Public method
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

  NameDescription
Public property
Attributes
This is a collection of child attributes that have been added to this attribute.
Public property
Categories
This is a user-defined collection of categories for the object that can be used for querying and/or reporting purposes.
Public property
CategoriesString
This read-only property returns the list of categories in a string separated by semicolons.
Public property
ConfigString
This property returns the current configuration of the attribute's data reference as a string suitable for displaying to an end-user.
Public property
Data
This read-only property returns the data access object for this AFAttribute.
Public property
Database
This read-only property returns the AFDatabase where this object is defined.
Public property
DataReference
The instance of the data reference used by the AFAttribute to get and set values in a data source.
Public property
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.
Public property
DefaultUOM
This property defines the default unit of measure (UOM) for the attribute's value.
Public property
Description
Read/write property that provides a more detailed description of the object.
Public property
DisplayDigits
The DisplayDigits property controls the format of numeric values on displays and in reports.
Public propertyCode example
DisplayUOM
This property returns the display unit of measure (UOM) for the attribute's value.
Public property
Element
This read-only property returns the AFBaseElement that owns this AFAttribute.
Public property
HasChildren
This read-only property returns if the attribute has child attributes.
Public property
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.)
Public property
Identity
This read-only property contains identity of the object.
(Inherited from AFObject.)
Public property
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.
Public property
IsConfigurationItem
This property determines whether this attribute is a configuration item for the associated element.
Public property
IsDataReferenceDefinedByTemplate
This read-only property indicates if this attribute's DataReference and ConfigString are fully defined by the AFElementTemplate.
Public property
IsDeleted
This read-only property indicates whether the object has been deleted.
(Inherited from AFObject.)
Public property
IsDynamic
This property indicates if this attribute is dynamic.
Public property
IsExcluded
This property determines whether this attribute is excluded for the associated element.
Public property
IsHidden
This property determines whether this attribute is hidden in client applications.
Public property
IsManualDataEntry
This property determines whether this attribute is used for manual data entry.
Public property
Name
This property defines the name that identifies the object.
Public property
Parent
This read-only property returns the AFAttribute that is the parent of this attribute.
Public property
PIPoint
The PIPoint associated with this attribute.
Public property
PISystem
This read-only property allows access to the PISystem associated with this object.
(Inherited from AFObject.)
Public property
RawPIPoint Obsolete.
Returns the raw PISDK.PIPoint associated with this attribute.
Public property
ServerTime
Gets the current time of the server associated with this AFAttribute.
Public property
ServerTimeSource
Gets the server time source associated with this AFAttribute.
Public property
ServerTimeZone
Gets the current time zone of the server associated with this AFAttribute.
Public property
SourceUOM
This property specifies the source unit of measure (UOM) for the attribute's value.
Public property
Step
This property returns if the attribute's value is stepped.
Public property
SupportedContexts
This read-only property specifies which of the data reference contexts are supported when getting and/or setting values.
Public property
SupportedDataMethods
This read-only property specifies which of the data methods are supported by the data reference.
Public property
SupportedMethods
This read-only property specifies which of the data reference methods for getting and/or setting values are supported.
Public property
Template
This read-only property returns the AFAttributeTemplate that was used to create this AFAttribute.
Public property
Trait
This property specifies the attribute trait for this attribute.
Public property
Type
This property specifies the type of the attribute's value.
Public property
TypeQualifier
Specifies a further qualification of the types of values available for this attribute.
Public property
UniqueID
Read-only property that provides the object's ID as a String.
(Inherited from AFObject.)

Methods

  NameDescription
Public method
CompareTo(Object)
Compares this instance with a specified Object.
(Inherited from AFObject.)
Public method
CompareTo(AFObject)
Compares this instance with a specified AFObject.
(Inherited from AFObject.)
Public method
Equals(Object)
Determines whether the specified Object is equal to the current object.
(Inherited from AFObject.)
Public method
Equals(AFObject)
Indicates whether the current object is equal to another object of the same type.
(Inherited from AFObject.)
Public methodStatic member
FindAttribute(String, AFObject)
Retrieves the AFAttribute object identified by the path string relative to the specified object.
Public methodStatic member
FindAttribute(AFBaseElement, AFAttributeTemplate)
Retrieves the AFAttribute object created from the specified AFAttributeTemplate.
Public methodStatic member
FindAttribute(AFBaseElement, Guid)
Retrieves the AFAttribute with the specified unique identifier.
Public methodStatic member
FindAttributes
Finds a list of AFAttribute objects identified by the path, relative from the specified object.
Public methodStatic member
FindAttributesByPath(IEnumerableString, AFObject)
Retrieves the AFAttribute objects identified by the path strings as keyed results.
Public methodStatic member
FindAttributesByPath(IEnumerableString, AFObject, IDictionaryString, String)
Retrieves the AFAttribute objects identified by the path strings as a list.
Public methodStatic member
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.
Public methodStatic member
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.
Public methodStatic member
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.
Public methodStatic member
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.
Public methodStatic member
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.
Public methodStatic member
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.
Public methodStatic member
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.
Public methodStatic member
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.
Public methodStatic member
FindNotificationAttributes(AFDatabase, String, AFCategory, AFElementTemplate, String, AFCategory, TypeCode, AFSortField, AFSortOrder, Int32)
Retrieves a non-paged collection of AFNotificationAFAttribute objects matching the specified filters.
Public methodStatic member
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.
Public methodStatic member
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.
Public methodStatic member
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.
Public method
GetAttributeByTrait
Retrieves the child AFAttribute with the specified AFAttributeTrait.
Public method
GetAttributesByTrait
Retrieves a list of child AFAttribute objects identified by the specified list of attribute traits.
Public method
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.)
Public method
GetPath
Returns the full path to the object, using just the names.
(Inherited from AFObject.)
Public method
GetPath(AFObject)
Returns the path to the object relative from another object.
(Inherited from AFObject.)
Public method
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.)
Public method
GetPaths
Get all the relative paths to this AFAttribute.
Public method
GetType
Gets the Type of the current instance.
(Inherited from Object.)
Public method
GetValue
This method gets the value for an attribute based upon the data reference configuration in the units of the DefaultUOM for the attribute.
Public method
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.
Public method
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.
Public method
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.
Public method
GetValue(UOM)
This method gets the value for an attribute based upon the data reference configuration in the specified units-of-measure.
Public method
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.
Public method
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.
Public method
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.
Public method
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.
Public method
GetValues(AFAnalysis, IListAFCase, UOM)
This method gets a collection of AFValue objects for an attribute in each of the cases.
Public method
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.
Public method
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.
Public method
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.
Public method
Persist
This method returns the persistence string for the object.
(Overrides AFObjectPersist.)
Public method
RawPIPointPath
Returns the path to the PIPoint that the attribute represents.
Public method
ResetToTemplate
This method will reset the AFAttribute back to its template default values.
Public methodStatic member
SetConfigStrings
Set the ConfigString values for the specified list of attributes.
Public method
SetValue(AFValue)
This method sets the value for an attribute based upon the data reference configuration using the specified AFValue object.
Public method
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.
Public method
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.
Public 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.
Public method
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.
Public 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.
Public 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.

Version Information

AFSDK


See Also

TitleResults for “How to create a CRG?”Also Available in