Click or drag to resize
OSIsoft, LLC

AFElement Class

The AFElement is a logical grouping of attributes and child elements.

Inheritance Hierarchy

Namespace:  OSIsoft.AF.Asset
Assembly:  OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 2.10.6.195
Syntax
[SerializableAttribute]
public class AFElement : AFBaseElement, IAFTransactable, 
	IAFChangedEvent, IAFSecurable, IAFVersionable, IComparable<AFElement>

The AFElement type exposes the following members.

Constructors
  NameDescription
Public methodAFElement
Initializes a new instance of the class with default values.
Public methodAFElement(String)
Initializes a new instance of the class with the specified name.
Public methodAFElement(String, AFElementTemplate)
Initializes a new instance of the class with the specified name.
Top
Properties
  NameDescription
Public propertyAnalyses
This is a collection of analyses that target this element.
Public propertyAttributes
This is a collection of attributes that are owned by this element.
(Inherited from AFBaseElement.)
Public propertyCategories
This is a user-defined collection of categories for the object that can be used for querying and/or reporting purposes.
(Inherited from AFBaseElement.)
Public propertyCategoriesString
This read-only property returns the list of categories in a string separated by semicolons.
(Inherited from AFBaseElement.)
Public propertyCheckOutInfo
This read-only property returns the checked out status information for the object.
Public propertyDatabase
This read-only property returns the AFDatabase where this object is defined.
(Inherited from AFBaseElement.)
Public propertyDefaultAttribute
The default AFAttribute for the AFBaseElement.
(Inherited from AFBaseElement.)
Public propertyDefaultInputPort
The default input AFPort for the AFBaseElement.
(Inherited from AFBaseElement.)
Public propertyDefaultOutputPort
The default output AFPort for the AFBaseElement.
(Inherited from AFBaseElement.)
Public propertyDefaultUndirectedPort
The default undirected AFPort for the AFBaseElement.
(Inherited from AFBaseElement.)
Public propertyDescription
Read/write property that provides a more detailed description of the object.
(Inherited from AFBaseElement.)
Public propertyElements
This is a collection of child elements that have been added to this element.
Public propertyExtendedProperties
A dictionary of extended properties that can be used to store application specific information.
(Inherited from AFBaseElement.)
Public propertyHasAnalyses
This read-only property returns if there are any AFAnalysis objects that target this element.
Public propertyHasChildren
This read-only property returns if the element has child elements.
Public propertyHasNotifications
This read-only property returns if there are any AFNotification objects that target this element.
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 propertyIsAnnotated
This property indicates whether this element has any annotations.
(Inherited from AFBaseElement.)
Public propertyIsDeleted
This read-only property indicates whether the object has been deleted.
(Inherited from AFObject.)
Public propertyIsDirty
This read-only property indicates whether the object has been modified since the last save to the PI AF Server.
Public propertyIsNew
This read-only property indicates whether the object is new and has never been saved to the PI AF Server.
Public propertyIsRoot
This read-only property returns if the element is a member of the AFDatabase.Elements collection.
Public propertyName
Read/write property that identifies the name of the object.
(Inherited from AFBaseElement.)
Public propertyStatic memberNone
An AFElement that represents no element.
Public propertyNotificationRules
This is a collection of AFNotificationRule objects that target this element.
Public propertyParent
This property returns the primary parent AFElement that owns the element if it is referenced by another element.
Public propertyParents Obsolete.
This is a collection of all AFElement objects that reference this element.
Public propertyPISystem
This read-only property allows access to the PISystem associated with this object.
(Inherited from AFObject.)
Public propertyPorts
This is a collection of AFPort objects representing the possible connection ports for this element. Ports are used in a AFModel to define an AFConnection between AFBaseElement object.
(Inherited from AFBaseElement.)
Public propertyQueryDate
This read-only property returns the date used to retrieve the version of an object.
Public propertySecurity
This read-only property returns the AFSecurity information for the object.
Public propertyTemplate
The AFElementTemplate that was used to define this object.
(Inherited from AFBaseElement.)
Public propertyType
This property specifies the base type of the element.
(Overrides AFBaseElementType.)
Public propertyUniqueID
Read-only property that provides the object's ID as a String.
(Inherited from AFObject.)
Public propertyVersion
This read-only property returns the current version information as an AFVersion object.
Top
Methods
  NameDescription
Public methodCode exampleApplyChanges
This method applies the changes to the object and makes those changes available to other objects for the current user.
Public methodApplyQueryDate
Applies the specified query date to the current object and returns an object in the new context.
Public methodChangeReferenceType
Change the existing AFReferenceType between a child element or the AFDatabase.
Public methodCode exampleCheckIn
This method checks in (commits) all the changes to the object by saving the information to persistent storage.
Public methodCheckOut
This method locks the object so that its configuration can be modified.
Public methodStatic memberCheckOutElements
Check out the objects with the specified unique identifiers at the specified query date.
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 methodCode exampleConvertTo
Converts the current object to the specified type of an AFElement.
Public methodCreateDefaultPorts
This method can be used to create the default connection ports based upon the element's type.
Public methodCreateElementTemplate
Create an AFElementTemplate based upon the element.
(Inherited from AFBaseElement.)
Public methodDelete
Deletes all versions of this element from the AFDatabase.
Public methodStatic memberCode exampleDeleteElements
Delete the objects with the specified unique identifiers.
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 memberFindElement(PISystem, Guid)
Retrieves the AFElement object with the specified unique identifier at the AFTime.MaxValue query date.
Public methodStatic memberFindElement(PISystem, Guid, Guid)
Retrieves the AFElement object with the specified unique identifier and the specified version id.
Public methodStatic memberFindElement(PISystem, Guid, Object)
Retrieves the AFElement object with the specified unique identifier at the specified query date.
Public methodStatic memberFindElements(PISystem, Guid, Object)
Performs a search within the PISystem to retrieve a collection of AFElement objects with the specified list of unique identifiers.
Public methodStatic memberFindElements(AFDatabase, AFElement, String, AFSearchField, Boolean, AFSortField, AFSortOrder, Int32)
Performs a non-paged text search within the AFDatabase to retrieve a collection of AFElement objects which have a field that matches the specified query string.
Public methodStatic memberFindElements(AFDatabase, AFElement, String, AFCategory, AFElementTemplate, AFElementType, Boolean, AFSortField, AFSortOrder, Int32) Obsolete.
Performs a search on the element's name within the AFDatabase to retrieve a non-paged collection of AFElement objects that match the specified query string and additional filters.
Public methodStatic memberFindElements(AFDatabase, AFElement, String, AFSearchField, Boolean, AFSortField, AFSortOrder, Int32, Int32, Int32)
Performs a paged text search within the AFDatabase to retrieve a collection of AFElement objects which have a field that matches the specified query string.
Public methodStatic memberFindElements(AFDatabase, AFElement, String, String, AFCategory, AFElementTemplate, AFElementType, Boolean, AFSortField, AFSortOrder, Int32) Obsolete.
Performs a search on the element's name within the AFDatabase to retrieve a non-paged collection of AFElement objects that match the specified query string and additional filters.
Public methodStatic memberFindElements(AFDatabase, AFElement, String, AFCategory, AFElementTemplate, AFElementType, Boolean, AFSortField, AFSortOrder, Int32, Int32, Int32) Obsolete.
Performs a search on the element's name within the AFDatabase to retrieve a paged collection of AFElement objects that match the specified query string and additional filters.
Public methodStatic memberFindElements(AFDatabase, AFElement, String, String, AFCategory, AFElementTemplate, AFElementType, Boolean, AFSortField, AFSortOrder, Int32, Int32, Int32) Obsolete.
Performs a search on the element's name within the AFDatabase to retrieve a paged collection of AFElement objects that match the specified query string and additional filters.
Public methodStatic memberCode exampleFindElementsByAttribute(AFElement, String, AFAttributeValueQuery, Boolean, AFSortField, AFSortOrder, Int32) Obsolete.
Performs a search on the element's name and attribute values within the AFDatabase to retrieve a non-paged collection of AFElement objects.
Public methodStatic memberCode exampleFindElementsByAttribute(AFElement, String, AFAttributeValueQuery, Boolean, AFSortField, AFSortOrder, Int32, Int32, Int32) Obsolete.
Performs a search on the element's name and attribute values within the AFDatabase to retrieve a paged collection of AFElement objects.
Public methodStatic memberCode exampleFindElementsByAttribute(AFElement, String, String, AFCategory, AFAttributeValueQuery, Boolean, AFSortField, AFSortOrder, Int32) Obsolete.
Performs a search on the element's name, category, and attribute values within the AFDatabase to retrieve a non-paged collection of AFElement objects.
Public methodStatic memberCode exampleFindElementsByAttribute(AFElement, String, String, AFCategory, AFAttributeValueQuery, Boolean, AFSortField, AFSortOrder, Int32, Int32, Int32) Obsolete.
Performs a search on the element's name, description, category, and attribute values within the AFDatabase to retrieve a paged collection of AFElement objects.
Public methodStatic memberFindElementsByCategory(AFDatabase, AFElement, AFCategory, Boolean, AFSortField, AFSortOrder, Int32) Obsolete.
Retrieves a non-paged collection of AFElement objects that have the specified AFCategory defined for the element.
Public methodStatic memberFindElementsByCategory(AFDatabase, AFElement, AFCategory, Boolean, AFSortField, AFSortOrder, Int32, Int32, Int32) Obsolete.
Retrieves a paged collection of AFElement objects that have the specified AFCategory defined for the element.
Public methodStatic memberFindElementsByExtendedProperty(AFDatabase, String, IEnumerableGuid, Int32)
Retrieves a list of AFElement objects that have the specified extended property Guid values defined for the element.
Public methodStatic memberFindElementsByExtendedProperty(AFDatabase, String, IEnumerableString, Int32)
Retrieves a list of AFElement objects that have the specified extended property string values defined for the element.
Public methodStatic memberFindElementsByPath(IEnumerableString, AFObject)
Retrieves the AFElement objects identified by the path strings as keyed results.
Public methodStatic memberFindElementsByPath(IEnumerableString, AFObject, IDictionaryString, String)
Retrieves the AFElement objects identified by the path strings as a list.
Public methodStatic memberCode exampleFindElementsByReferenceType(AFDatabase, AFElement, AFReferenceType, AFSortField, AFSortOrder, Int32) Obsolete.
Retrieves a non-paged collection of AFElement objects that are referenced by the AFReferenceType under the specified searchRoot or AFDatabase.
Public methodStatic memberCode exampleFindElementsByReferenceType(AFDatabase, AFElement, AFReferenceType, AFSortField, AFSortOrder, Int32, Int32, Int32) Obsolete.
Retrieves a paged collection of AFElement objects that are referenced by the AFReferenceType under the specified searchRoot or AFDatabase.
Public methodStatic memberFindElementsByTemplate(AFDatabase, AFObject, AFElementTemplate, Boolean, AFSortField, AFSortOrder, Int32)
Retrieves a non-paged collection of AFElement objects that are instantiated from the specified AFElementTemplate.
Public methodStatic memberFindElementsByTemplate(AFDatabase, AFObject, AFElementTemplate, Boolean, AFSortField, AFSortOrder, Int32, Int32, Int32)
Retrieves a paged collection of AFElement objects that are instantiated from the specified AFElementTemplate.
Public methodGetAnalyses Obsolete.
Retrieves a collection of AFAnalysis objects that target this element.
Public methodGetAnnotations
Retrieves a collection of existing AFAnnotation objects belonging to this AFBaseElement.
(Inherited from AFBaseElement.)
Public methodGetAttributeByTrait
Retrieves the child AFAttribute with the specified AFAttributeTrait.
(Inherited from AFBaseElement.)
Public methodGetAttributesByTrait
Retrieves a list of child AFAttribute objects identified by the specified list of attribute traits.
(Inherited from AFBaseElement.)
Public methodStatic memberGetAttributeValues
This method gets a collection of AFValue objects for the specified attributes. The collection will be the same length and in the same order as the objectIds collection.
Public methodGetElements(AFSortField, AFSortOrder, Int32) Obsolete.
Retrieves a non-paged collection of child AFElement objects that have been added to this element.
Public methodGetElements(AFSortField, AFSortOrder, Int32, Int32, Int32) Obsolete.
Retrieves a paged collection of child AFElement objects that have been added to this element.
Public methodGetEventFrames(Object, Int32, Int32, AFEventFrameSearchMode, String, AFCategory, AFElementTemplate) Obsolete.
Retrieves a paged collection of AFEventFrame objects that reference this element limited to the specified count beginning at the requested start time in the specified direction.
Public methodGetEventFrames(AFSearchMode, Object, Object, String, AFCategory, AFElementTemplate, AFSortField, AFSortOrder, Int32, Int32) Obsolete.
Retrieves a paged collection of AFEventFrame objects that reference this element within the specified time range.
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 methodGetNotifications
Retrieves a collection of AFNotification objects that target this element.
Public methodGetParents(AFSortField, AFSortOrder, Int32)
Retrieves a non-paged collection of AFElement objects that reference this element.
Public methodGetParents(AFCategory, AFSortField, AFSortOrder, Int32)
Retrieves a non-paged collection of AFElement objects that reference this element using the specified AFCategory.
Public methodGetParents(AFReferenceType, AFSortField, AFSortOrder, Int32)
Retrieves a non-paged collection of AFElement objects that reference this element using the specified AFReferenceType.
Public methodGetParents(AFSortField, AFSortOrder, Int32, Int32, Int32)
Retrieves a paged collection of AFElement objects that reference this element.
Public methodGetParents(AFCategory, AFSortField, AFSortOrder, Int32, Int32, Int32)
Retrieves a paged collection of AFElement objects that reference this element using the specified AFCategory.
Public methodGetParents(AFReferenceType, AFSortField, AFSortOrder, Int32, Int32, Int32)
Retrieves a paged collection of AFElement objects that reference this element using the specified AFReferenceType.
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 methodStatic memberGetPath(String, IListAFElement)
Get a path to the child elements.
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 full paths to this AFElement.
Public methodGetPaths(String)
Get all the relative paths to this AFElement.
Public methodStatic memberGetPaths(String, IListAFElement)
Get all paths to the child elements.
Public methodGetReferenceTypes
Retrieves a collection of all AFReferenceType objects that represent types of references from this element to its child elements.
Public methodGetReferenceTypes(AFElement)
Retrieves a collection of AFReferenceType objects that represent types of references between this element and the specified related element.
Public methodGetSecurity
Gets the AFSecurity information of the specified security item associated with the object.
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodIsTypeOf
Checks if the current AFBaseElement is derived from the specified AFElementTemplate.
(Inherited from AFBaseElement.)
Public methodStatic memberCode exampleLoadAttributes(IListAFElement, IListAFAttributeTemplate)
Partially load the list of elements with the specified attributes.
Public methodStatic memberCode exampleLoadAttributes(PISystem, IListGuid, IListAFAttributeTemplate, Object)
Partially loads the AFElement objects for the list of unique identifiers with the specified attributes.
Public methodStatic memberCode exampleLoadElementReferences
Loads the AFElement objects referenced by the specified elements.
Public methodStatic memberCode exampleLoadElements(IListAFElement)
Loads the specified list AFElement objects.
Public methodStatic memberLoadElements(PISystem, Guid, Object)
Loads the AFElement objects with the specified unique identifiers at the specified query date.
Public methodStatic memberCode exampleLoadElementsToDepth
Loads the specified list AFElement objects and their child elements to the hierarchical depth specified.
Public methodStatic memberLoadParents
Loads the primary parent of each AFElement specified in the list.
Public methodPersist
This method returns the persistence string for the object.
(Inherited from AFObject.)
Public methodRefresh
Refreshes the client with any changes that have been made to the object since loaded.
Public methodToString
Returns a String that represents the current object.
(Inherited from AFObject.)
Public methodUndoCheckOut
This method discards all the changes to the object and all sub-objects since the last call to CheckOut. Any changes since the check out will be lost.
Top
Events
  NameDescription
Public eventCode exampleChanged
Event is raised when the object or one of its sub-objects is changed.
Top
Remarks

An element can be created from a template, or without a template. When based on a template, the element will derive its initial definition of Categories, Attributes, and Ports from the template. Later modifications to the template will be propagated to all elements created from it. If the template allows it, or if the element was not created from a template, then the element's categories, ports, and attributes can be augmented with additional members. The AFElementSearch class can be used for finding elements.

The AFModel object type is also an element that provides additional information to support models. When created from a template, the AFElementTemplate.InstanceType property specifies the type of element to create.

Child elements can be created using one of the AFElements.Add Overload methods of this object's Elements collection. A child element is related to its parent element by a AFReferenceType. An element may be parented by more than one element, although the reference types may restrict that ability in some instances.

An element implements the IAFVersionable interface which supports creating versions. The following properties and collections are common across all versions of the object:

The following properties and collections are specific to a version of the object: Auto-created Analyses and NotificationRules will only exist on the latest version of the element. Manually created Analyses and NotificationRules will exist across all versions of the element.

Caution note Caution
Using object versions can be expensive in memory usage and performance. Extra memory is required to store the versions in the server and for each version of the object loaded in the client. Performance is degraded because of the extra data to be searched in the server and returned back to the client.

Examples
// This example demonstrates how to create an element and display its information.

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

// Create an Element
AFElement myElement = myDB.Elements.Add("MyElement*");
myElement.Description = "This is my element";

// Display Element Information
foreach (AFElement CurElement in myDB.Elements)
{
    Console.WriteLine("Name of Element = {0}", CurElement.Name);
    Console.WriteLine("Description = {0}", CurElement.Description);
}
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