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

AF SDK Reference

AFEventFrame.FindEventFramesByAttribute Method (AFEventFrame, AFSearchMode, Object, Object, String, String, AFDurationQuery[], AFAttributeValueQuery[], Boolean, AFSortField, AFSortOrder, Int32, Int32)

AFEventFrame.FindEventFramesByAttribute Method (AFEventFrame, AFSearchMode, Object, Object, String, String, AFDurationQuery[], AFAttributeValueQuery[], Boolean, AFSortField, AFSortOrder, Int32, Int32)

  • Last UpdatedNov 18, 2025
  • 9 minute read
AFEventFrame.FindEventFramesByAttribute Method (AFEventFrame, AFSearchMode, Object, Object, String, String, AFDurationQuery[], AFAttributeValueQuery[], Boolean, AFSortField, AFSortOrder, Int32, Int32)

Note: This API is now obsolete.

Performs a search on the event frame's information and attribute value within the AFDatabase to retrieve a paged collection of AFEventFrame objects.

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

Syntax

[BrowsableAttribute(false)]
[ObsoleteAttribute("This method has been replaced by the 'AFEventFrameSearch' class using the 'Root', 'Start', 'End', 'Name', 'ElementName', 'Duration' and attribute value filters.")]
public static AFNamedCollectionList<AFEventFrame> FindEventFramesByAttribute(
	AFEventFrame searchRoot,
	AFSearchMode searchMode,
	Object startTime,
	Object endTime,
	string nameFilter,
	string referencedElementNameFilter,
	AFDurationQuery[] durationQuery,
	AFAttributeValueQuery[] valueQuery,
	bool searchFullHierarchy,
	AFSortField sortField,
	AFSortOrder sortOrder,
	int startIndex,
	int maxCount
)
<BrowsableAttribute(false)>
<ObsoleteAttribute("This method has been replaced by the 'AFEventFrameSearch' class using the 'Root', 'Start', 'End', 'Name', 'ElementName', 'Duration' and attribute value filters.")>
Public Shared Function FindEventFramesByAttribute ( 
	searchRoot As AFEventFrame,
	searchMode As AFSearchMode,
	startTime As Object,
	endTime As Object,
	nameFilter As String,
	referencedElementNameFilter As String,
	durationQuery As AFDurationQuery(),
	valueQuery As AFAttributeValueQuery(),
	searchFullHierarchy As Boolean,
	sortField As AFSortField,
	sortOrder As AFSortOrder,
	startIndex As Integer,
	maxCount As Integer
) As AFNamedCollectionList(Of AFEventFrame)

Dim searchRoot As AFEventFrame
Dim searchMode As AFSearchMode
Dim startTime As Object
Dim endTime As Object
Dim nameFilter As String
Dim referencedElementNameFilter As String
Dim durationQuery As AFDurationQuery()
Dim valueQuery As AFAttributeValueQuery()
Dim searchFullHierarchy As Boolean
Dim sortField As AFSortField
Dim sortOrder As AFSortOrder
Dim startIndex As Integer
Dim maxCount As Integer
Dim returnValue As AFNamedCollectionList(Of AFEventFrame)

returnValue = AFEventFrame.FindEventFramesByAttribute(searchRoot, 
	searchMode, startTime, endTime, nameFilter, 
	referencedElementNameFilter, durationQuery, 
	valueQuery, searchFullHierarchy, 
	sortField, sortOrder, startIndex, 
	maxCount)
public:
[BrowsableAttribute(false)]
[ObsoleteAttribute(L"This method has been replaced by the 'AFEventFrameSearch' class using the 'Root', 'Start', 'End', 'Name', 'ElementName', 'Duration' and attribute value filters.")]
static AFNamedCollectionList<AFEventFrame^>^ FindEventFramesByAttribute(
	AFEventFrame^ searchRoot, 
	AFSearchMode searchMode, 
	Object^ startTime, 
	Object^ endTime, 
	String^ nameFilter, 
	String^ referencedElementNameFilter, 
	array<AFDurationQuery>^ durationQuery, 
	array<AFAttributeValueQuery>^ valueQuery, 
	bool searchFullHierarchy, 
	AFSortField sortField, 
	AFSortOrder sortOrder, 
	int startIndex, 
	int maxCount
)
[<BrowsableAttribute(false)>]
[<ObsoleteAttribute("This method has been replaced by the 'AFEventFrameSearch' class using the 'Root', 'Start', 'End', 'Name', 'ElementName', 'Duration' and attribute value filters.")>]
static member FindEventFramesByAttribute : 
        searchRoot : AFEventFrame * 
        searchMode : AFSearchMode * 
        startTime : Object * 
        endTime : Object * 
        nameFilter : string * 
        referencedElementNameFilter : string * 
        durationQuery : AFDurationQuery[] * 
        valueQuery : AFAttributeValueQuery[] * 
        searchFullHierarchy : bool * 
        sortField : AFSortField * 
        sortOrder : AFSortOrder * 
        startIndex : int * 
        maxCount : int -> AFNamedCollectionList<AFEventFrame> 

Parameters

searchRoot
Type: OSIsoft.AF.EventFrameAFEventFrame
The root object to start the search. If , then the search starts at the AFDatabase.
searchMode
Type: OSIsoft.AF.AssetAFSearchMode
Determines how the startTime and endTime parameters are treated when searching for event frame objects to be included in the returned collection.
startTime
Type: SystemObject
An object representing the starting time for the search. The startTime must be less than or equal to the endTime. The searchMode parameter will control whether the comparison will be performed against the event frame's StartTime or EndTime. The value may be an AFTime, DateTime, PITime, String, or numeric. A DateTime (or a DATE will be treated as UTC time if its Kind property is set to Unspecified. Because DATE values from COM or VB6 clients are marshalled as Unspecified, these client applications must convert to UTC prior to marshalling. An integer numeric represents the number of ticks (100-nanosecond intervals) since January 1, 0001. A floating point numeric represents the number of seconds since January 1, 1970 UTC. A String is interpreted as local time, unless it contains a time zone indicator such as a trailing "Z" or "GMT". Strings will be interpreted with the AFTime.Parse Overload methods so that relative formats with intervals ("*", "T+3h", etc.) are also supported. Relative time intervals are based on the object's QueryDate.
endTime
Type: SystemObject
An object representing the ending time for the search. The endTime must be greater than or equal to the startTime. The searchMode parameter will control whether the comparison will be performed against the event frame's StartTime or EndTime. The value may be an AFTime, DateTime, PITime, String, or numeric. A DateTime (or a DATE will be treated as UTC time if its Kind property is set to Unspecified. Because DATE values from COM or VB6 clients are marshalled as Unspecified, these client applications must convert to UTC prior to marshalling. An integer numeric represents the number of ticks (100-nanosecond intervals) since January 1, 0001. A floating point numeric represents the number of seconds since January 1, 1970 UTC. A String is interpreted as local time, unless it contains a time zone indicator such as a trailing "Z" or "GMT". Strings will be interpreted with the AFTime.Parse Overload methods so that relative formats with intervals ("*", "T+3h", etc.) are also supported. Relative time intervals are based on the object's QueryDate.
nameFilter
Type: SystemString
The name filter string used for finding objects.

The query string (or match pattern) can include regular characters and wildcard characters. Regular characters must match exactly the characters specified in the query string. Wildcard characters can be matched with arbitrary fragments of the query string. Wildcard characters can be escaped using the single backslash (\) character. Use a double backslash (\\) to match a single backslash. The syntax of the query string has the following rules:

  • If or empty string, then everything will be matched.
  • If no wildcards, then an exact match on the query string is performed.
  • Wildcard * can be placed anywhere in the query string and matches zero or more characters.
  • Wildcard ? can be placed anywhere in the query string and matches exactly one character.
  • One character in a set of characters are matched by placing them within [ ]. For example, a[bc] would match 'ab' or 'ac', but it would not match 'ad' or 'abd'.
  • One character in a set of characters are not matched by placing them within [! ]. For example, a[!bc] would match 'ad', but it would not match 'ab', 'ac', or 'abd'.
  • A character in a range of characters from first to last are matched using the following syntax: [first - last]. For example, a[a-c] would match 'aa', 'ab', or 'ac', but it would not match 'ad' or 'abc'.

referencedElementNameFilter
Type: SystemString
The name filter string of an AFElement in the event frame's ReferencedElements collection. Uses same filtering rules as specified for the nameFilter parameter. To obtain an exact match to a specific element, specify the element's ID using a format that includes the opening and closing braces, such as ID.ToString("B").
durationQuery
Type: OSIsoft.AF.EventFrameAFDurationQuery
An array of duration queries that are ANDed together to find the desired AFEventFrame objects. To not filter by duration, set this parameter to .
valueQuery
Type: OSIsoft.AF.AssetAFAttributeValueQuery
An array of attribute value queries that are ANDed together to find the desired AFEventFrame objects. At least one value query must be specified.
searchFullHierarchy
Type: SystemBoolean
Specifies if the search should include objects nested further than the immediate children of the searchRoot.
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).

Return Value

Type: AFNamedCollectionListAFEventFrame
Returns a collection containing the specified page of AFEventFrame objects which match the specified nameFilter string and attribute value query.

Remarks

An object matches the search if the specified nameFilter is found in the object's Name property and the attribute's value matches the specified attribute value query conditions.

This will only return objects of type AFEventFrame. Types of event frames that inherit from AFEventFrame will not be returned. Use the specific find methods to return types of event frames that inherit from AFEventFrame.

How results are returned from an AFAttributeValueQuery search depends on whether the attribute template IsIndexed property is set and which AFSearchOperator is used for the search. If the attribute template has the IsIndexed property is set to , then an indexed search value is stored in the PI AF Server which is truncated to 40 characters for string values so that performance is improved. By default, attribute values are not indexed.

Searching attributes with an AFDataReference defined will be slower because the value does not exist on the server. Each attribute's AFDataReference must be executed on the client to obtain the value to evaluate the query. If the AFAttributeTemplate does not define a DataReferencePlugIn and an AFAttribute overrides the template by setting its DataReferencePlugIn, then the attribute's value from the DataReference will not be used when evaluating the query. This could cause unexpected results to be returned from this method. Therefore, an AFDataReference should be defined on the template if it will be used in a query and an AFAttribute will be defining a DataReference.

Important note Important
This will only search event frames that have been checked into the server. If the attribute's IsConfigurationItem property is , then only the attribute values that have been checked into the server will be searched. If the attribute's values have been captured for the event frame (the AreValuesCaptured property is ), then only the attribute values that have been captured and checked into the server will be searched.
Important note Important
The value of any attributes used in the query with a configured DataReference will be evaluated on the client. This means that additional results could be removed from those returned from the server and therefore return less than the specified maxCount.

Important note Important
Consider using the new AFEventFrameSearch class for finding event frames instead of using this method.

Version Information

AFSDK

Supported in: 2.8.5, 2.8, 2.7.5, 2.7, 2.6, 2.5, 2.4
Obsolete (compiler warning) in 3.1.1
Obsolete (compiler warning) in 3.1.0
Obsolete (compiler warning) in 3.0.2
Obsolete (compiler warning) in 3.0.1
Obsolete (compiler warning) in 3.0.0
Obsolete (compiler warning) in 2.10.11
Obsolete (compiler warning) in 2.10.5
Obsolete (compiler warning) in 2.10.0
Obsolete (compiler warning) in 2.10
Obsolete (compiler warning) in 2.9.5
Obsolete (compiler warning) in 2.9

See Also

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