AFAttributeTemplate Class
- Last UpdatedNov 18, 2025
- 9 minute read
- PI System
- AF SDK 2024 R2
- Developer
The AFAttributeTemplate provides the definition used to create
an AFAttribute.

Inheritance Hierarchy
Namespace: OSIsoft.AF.Asset
Assembly: OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 3.1.1.1182
Syntax
[SerializableAttribute] public sealed class AFAttributeTemplate : AFObject, IAFAttribute, IComparable<AFAttributeTemplate>
<SerializableAttribute> Public NotInheritable Class AFAttributeTemplate Inherits AFObject Implements IAFAttribute, IComparable(Of AFAttributeTemplate) Dim instance As AFAttributeTemplate
[SerializableAttribute] public ref class AFAttributeTemplate sealed : public AFObject, IAFAttribute, IComparable<AFAttributeTemplate^>
[<SealedAttribute>] [<SerializableAttribute>] type AFAttributeTemplate = class inherit AFObject interface IAFAttribute interface IComparable<AFAttributeTemplate> end
The AFAttributeTemplate type exposes the following members.
Properties
| Name | Description | |
|---|---|---|
| AttributeTemplates |
This is a collection of child attribute templates that have been added to this
attribute template.
| |
| 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 template's data reference
as a string.
| |
| Database |
This read-only property returns the AFDatabase where this object is defined.
| |
| DataReference |
The instance of the data reference used by the AFAttributeTemplate to
configure 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 value of
the attribute created from this template.
| |
| 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 value of the attribute
created from this template.
| |
| ElementTemplate |
This read-only property returns the AFElementTemplate that owns this
AFAttributeTemplate.
| |
| HasChildren |
This read-only property returns if the attribute template has child attribute templates.
| |
| 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.) | |
| IsConfigurationItem |
This property determines whether the attribute created from this template
is a configuration item for the associated element.
| |
| IsDeleted |
This read-only property indicates whether the object has been deleted.
(Inherited from AFObject.) | |
| IsExcluded |
This property is the default value for the IsExcluded
property of the attribute created from this template.
| |
| IsHidden |
This property determines whether the attribute created from this template
is hidden in client applications.
| |
| IsIndexed |
This property determines whether the value of the attribute created from this template
is indexed to improve performance of attribute value searches.
| |
| IsManualDataEntry |
This property determines whether the attribute created from this template
is used for manual data entry.
| |
| Name |
This property defines the name that identifies the object.
| |
| Parent |
This read-only property returns the AFAttributeTemplate that is the parent
of this attribute template.
| |
| PISystem |
This read-only property allows access to the PISystem associated with this
object.
(Inherited from AFObject.) | |
| Trait |
This property specifies the attribute trait for the attributes created from this template.
| |
| 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.) | |
| FindAttributeTemplate(String, AFObject) |
Retrieves the AFAttributeTemplate object identified by the path string relative to
the specified object.
| |
| FindAttributeTemplate(AFElementTemplate, Guid) |
Retrieves the AFAttributeTemplate object with the specified unique identifier.
| |
| FindAttributeTemplates |
Finds a list of AFAttributeTemplate objects identified by the path, relative from the specified object.
| |
| GetAttributeTemplateByTrait |
Retrieves the child AFAttributeTemplate with the specified AFAttributeTrait.
| |
| GetAttributeTemplatesByTrait |
Retrieves a list of child AFAttributeTemplate 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.) | |
| GetType | Gets the Type of the current instance. (Inherited from Object.) | |
| GetValue |
Gets the default value for an attribute template in the specified unit of measure.
This value will be used as the default value for the attributes created from this
template.
| |
| Persist |
This method returns the persistence string for the object.
(Inherited from AFObject.) | |
| SetValue |
Sets the default value for an attribute template in the specified unit of measure.
This value will be used as the
default value for the attributes created from this template.
| |
| ToString |
Returns a String that represents the current object.
(Inherited from AFObject.) |
Remarks
A template specifies the value of the Name,
Description, IsConfigurationItem,
Categories, Type, TypeQualifier,
and DefaultUOM properties of the attribute.
This template also provides default values for the DataReferencePlugIn and
its associated ConfigString.
Examples
// This example demonstrates how to create an attribute templates for an // element template and display information about it. // Get the Database PISystems myPISystems = new PISystems(); PISystem myPISystem = myPISystems.DefaultPISystem; AFDatabase myDB = myPISystem.Databases.DefaultDatabase; // Create an Element Template AFElementTemplate myElemTempl = myDB.ElementTemplates.Add("MyElementTemplate"); // Create an Attribute Template AFAttributeTemplate myAttrTempl = myElemTempl.AttributeTemplates.Add("MyAttributeTemplate"); myAttrTempl.Description = "Attribute Template for MyElementTemplate"; myAttrTempl.DefaultUOM = myPISystem.UOMDatabase.UOMs["kelvin"]; myAttrTempl.DataReferencePlugIn = AFDataReference.GetPIPointDataReference(myPISystem); myAttrTempl.ConfigString = @"\\%Server%\sinusoid"; // Get Value object myValue = myAttrTempl.GetValue(myPISystem.UOMDatabase.UOMs["degree Celsius"]); Console.WriteLine("Attribute Template Value = {0}", myValue); // Display Attribute Template Information foreach (AFAttributeTemplate CurAttrTempl in myElemTempl.AttributeTemplates) { Console.WriteLine("Name of Attribute Template = {0}", CurAttrTempl.Name); Console.WriteLine("Description = {0}", CurAttrTempl.Description); Console.WriteLine("Default UOM = {0}", CurAttrTempl.DefaultUOM.Name); Console.WriteLine("DataReference = {0}", CurAttrTempl.DataReference.Name); Console.WriteLine("ConfigString = {0}", CurAttrTempl.ConfigString); }
' This example demonstrates how to create an attribute templates for an ' element template 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 Template Dim myElemTempl As AFElementTemplate = myDB.ElementTemplates.Add("MyElementTemplate") ' Create an Attribute Template Dim CurAttrTempl As AFAttributeTemplate = myElemTempl.AttributeTemplates.Add("MyAttributeTemplate") CurAttrTempl.Description = "Attribute Template for MyElementTemplate" CurAttrTempl.DefaultUOM = myPISystem.UOMDatabase.UOMs("kelvin") CurAttrTempl.DataReferencePlugIn = AFDataReference.GetPIPointDataReference(myPISystem) CurAttrTempl.ConfigString = "\\%Server%\sinusoid" ' Get Value Dim myValue As Object = CurAttrTempl.GetValue(myPISystem.UOMDatabase.UOMs("degree Celsius")) Console.WriteLine("Attribute Template Value = {0}", myValue) ' Display Attribute Template Information For Each CurAttrTempl In myElemTempl.AttributeTemplates Console.WriteLine("Name of Attribute Template = {0}", CurAttrTempl.Name) Console.WriteLine("Description = {0}", CurAttrTempl.Description) Console.WriteLine("Default UOM = {0}", CurAttrTempl.DefaultUOM.Name) Console.WriteLine("DataReference = {0}", CurAttrTempl.DataReference.Name) Console.WriteLine("ConfigString = {0}", CurAttrTempl.ConfigString) Next CurAttrTempl
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.