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

AF SDK Reference

AFElementTemplate.FindInstantiatedElements Method (Boolean, AFSortField, AFSortOrder, Int32, Int32, Int32)

AFElementTemplate.FindInstantiatedElements Method (Boolean, AFSortField, AFSortOrder, Int32, Int32, Int32)

  • Last UpdatedNov 18, 2025
  • 4 minute read
AFElementTemplate.FindInstantiatedElements Method (Boolean, AFSortField, AFSortOrder, Int32, Int32, Int32)
This method returns a paged collection of AFBaseElement objects that were created with this template.

Namespace:  OSIsoft.AF.Asset
Assembly:  OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 3.1.1.1182

Syntax

public AFNamedCollectionList<AFBaseElement> FindInstantiatedElements(
	bool includeDerived,
	AFSortField sortField,
	AFSortOrder sortOrder,
	int startIndex,
	int maxCount,
	out int totalCount
)
Public Function FindInstantiatedElements ( 
	includeDerived As Boolean,
	sortField As AFSortField,
	sortOrder As AFSortOrder,
	startIndex As Integer,
	maxCount As Integer,
	<OutAttribute> ByRef totalCount As Integer
) As AFNamedCollectionList(Of AFBaseElement)

Dim instance As AFElementTemplate
Dim includeDerived As Boolean
Dim sortField As AFSortField
Dim sortOrder As AFSortOrder
Dim startIndex As Integer
Dim maxCount As Integer
Dim totalCount As Integer
Dim returnValue As AFNamedCollectionList(Of AFBaseElement)

returnValue = instance.FindInstantiatedElements(includeDerived, 
	sortField, sortOrder, startIndex, 
	maxCount, totalCount)
public:
AFNamedCollectionList<AFBaseElement^>^ FindInstantiatedElements(
	bool includeDerived, 
	AFSortField sortField, 
	AFSortOrder sortOrder, 
	int startIndex, 
	int maxCount, 
	[OutAttribute] int% totalCount
)
member FindInstantiatedElements : 
        includeDerived : bool * 
        sortField : AFSortField * 
        sortOrder : AFSortOrder * 
        startIndex : int * 
        maxCount : int * 
        totalCount : int byref -> AFNamedCollectionList<AFBaseElement> 

Parameters

includeDerived
Type: SystemBoolean
If , then all elements created from this template and any template that is derived from this template will be included in the returned collection. If , then only elements created from this template will be included.
sortField
Type: OSIsoft.AFAFSortField
The field or property of the object used to sort the returned collection. This value should not be changed between calls when attempting to get the next page of items.
sortOrder
Type: OSIsoft.AFAFSortOrder
The order that the returned collection is sorted. This value should not be changed between calls when attempting to get the next page of items.
startIndex
Type: SystemInt32
The starting index (zero based) of the items to be returned.
maxCount
Type: SystemInt32
The maximum number of objects to be returned per call (the page size).
totalCount
Type: SystemInt32
The total number of objects that match the search criteria.

Return Value

Type: AFNamedCollectionListAFBaseElement
Returns the collection of the specified page of AFBaseElement objects that were created with this template or one of its derived templates if includeDerived is .

Remarks

This method can be used to return the collection of AFBaseElement objects that have been created or instantiated from this template. By setting the includeDerived parameter, the collection will also contain all elements that have been created from an AFElementTemplate derived from this template (see FindDerivedTemplates(Boolean, AFSortField, AFSortOrder, Int32)).

Important note Important
Only elements of the type specified by the InstanceType property will be returned. Any other type of elements created from this template will not be included in the returned collection.

Important note Important
Currently, paged collections are only supported for an InstanceType of AFElement, AFModel, or AFEventFrame. To retrieve all objects for the other instance types, you must get them all in one call with startIndex set to zero and maxCount set to Int32.MaxValue. The totalCount will be set to the total number of items returned for an InstanceType of AFEventFrame, AFTransfer, AFNotification, and AFCase.

Important note Important
Consider using one of the new AFSearch classes for finding elements instead of using this method.

Version Information

AFSDK


See Also

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