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

AF SDK Reference

AFAttributeTemplate Class

  • Last UpdatedNov 18, 2025
  • 9 minute read
AFAttributeTemplate Class
The AFAttributeTemplate provides the definition used to create an AFAttribute.

Inheritance Hierarchy

SystemObject
  OSIsoft.AFAFObject
    OSIsoft.AF.AssetAFAttributeTemplate

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

  NameDescription
Public property
AttributeTemplates
This is a collection of child attribute templates that have been added to this attribute template.
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 template's data reference as a string.
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 AFAttributeTemplate to configure 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 value of the attribute created from this template.
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 property
DisplayUOM
This property returns the display unit of measure (UOM) for the value of the attribute created from this template.
Public property
ElementTemplate
This read-only property returns the AFElementTemplate that owns this AFAttributeTemplate.
Public property
HasChildren
This read-only property returns if the attribute template has child attribute templates.
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
IsConfigurationItem
This property determines whether the attribute created from this template is a configuration item for the associated element.
Public property
IsDeleted
This read-only property indicates whether the object has been deleted.
(Inherited from AFObject.)
Public property
IsExcluded
This property is the default value for the IsExcluded property of the attribute created from this template.
Public property
IsHidden
This property determines whether the attribute created from this template is hidden in client applications.
Public property
IsIndexed
This property determines whether the value of the attribute created from this template is indexed to improve performance of attribute value searches.
Public property
IsManualDataEntry
This property determines whether the attribute created from this template 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 AFAttributeTemplate that is the parent of this attribute template.
Public property
PISystem
This read-only property allows access to the PISystem associated with this object.
(Inherited from AFObject.)
Public property
Trait
This property specifies the attribute trait for the attributes created from this template.
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
FindAttributeTemplate(String, AFObject)
Retrieves the AFAttributeTemplate object identified by the path string relative to the specified object.
Public methodStatic member
FindAttributeTemplate(AFElementTemplate, Guid)
Retrieves the AFAttributeTemplate object with the specified unique identifier.
Public methodStatic member
FindAttributeTemplates
Finds a list of AFAttributeTemplate objects identified by the path, relative from the specified object.
Public method
GetAttributeTemplateByTrait
Retrieves the child AFAttributeTemplate with the specified AFAttributeTrait.
Public method
GetAttributeTemplatesByTrait
Retrieves a list of child AFAttributeTemplate 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
GetType
Gets the Type of the current instance.
(Inherited from Object.)
Public method
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.
Public method
Persist
This method returns the persistence string for the object.
(Inherited from AFObject.)
Public method
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.
Public method
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.

Version Information

AFSDK


See Also

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