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

AF SDK Reference

AFCase.FindCases Method (AFAnalysis, Object, Int32, AFEventFrameSearchMode, String, AFCategory, AFElementTemplate)

AFCase.FindCases Method (AFAnalysis, Object, Int32, AFEventFrameSearchMode, String, AFCategory, AFElementTemplate)

  • Last UpdatedNov 18, 2025
  • 5 minute read
AFCase.FindCases Method (AFAnalysis, Object, Int32, AFEventFrameSearchMode, String, AFCategory, AFElementTemplate)
Retrieves a list of AFCase objects limited to the specified count beginning at the requested time in the specified direction.

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

Syntax

public static AFNamedCollectionList<AFCase> FindCases(
	AFAnalysis analysis,
	Object startTime,
	int maxCount,
	AFEventFrameSearchMode searchMode,
	string nameFilter,
	AFCategory elemCategory,
	AFElementTemplate elemTemplate
)
Public Shared Function FindCases ( 
	analysis As AFAnalysis,
	startTime As Object,
	maxCount As Integer,
	searchMode As AFEventFrameSearchMode,
	nameFilter As String,
	elemCategory As AFCategory,
	elemTemplate As AFElementTemplate
) As AFNamedCollectionList(Of AFCase)

Dim analysis As AFAnalysis
Dim startTime As Object
Dim maxCount As Integer
Dim searchMode As AFEventFrameSearchMode
Dim nameFilter As String
Dim elemCategory As AFCategory
Dim elemTemplate As AFElementTemplate
Dim returnValue As AFNamedCollectionList(Of AFCase)

returnValue = AFCase.FindCases(analysis, 
	startTime, maxCount, searchMode, 
	nameFilter, elemCategory, elemTemplate)
public:
static AFNamedCollectionList<AFCase^>^ FindCases(
	AFAnalysis^ analysis, 
	Object^ startTime, 
	int maxCount, 
	AFEventFrameSearchMode searchMode, 
	String^ nameFilter, 
	AFCategory^ elemCategory, 
	AFElementTemplate^ elemTemplate
)
static member FindCases : 
        analysis : AFAnalysis * 
        startTime : Object * 
        maxCount : int * 
        searchMode : AFEventFrameSearchMode * 
        nameFilter : string * 
        elemCategory : AFCategory * 
        elemTemplate : AFElementTemplate -> AFNamedCollectionList<AFCase> 

Parameters

analysis
Type: OSIsoft.AF.AnalysisAFAnalysis
The AFAnalysis to search for the requested objects.
startTime
Type: SystemObject
An object representing the starting time to begin the search. The search may compare against either the StartTime or EndTime of the case based on the searchMode parameter. 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.
maxCount
Type: SystemInt32
The maximum number of cases to be returned. More than the specified number may be returned if multiple items have the same StartTime for the last case returned.
searchMode
Type: OSIsoft.AF.EventFrameAFEventFrameSearchMode
Indicates the direction in time from the StartTime or EndTime to proceed when returning cases.
nameFilter
Type: SystemString
The case 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'.

elemCategory
Type: OSIsoft.AFAFCategory
Specify that returned cases must have this category. To not filter by element category, then specify for this parameter.
elemTemplate
Type: OSIsoft.AF.AssetAFElementTemplate
Specify that returned cases must have this template or a template derived from this template. To not filter by element template, then specify for this parameter.

Return Value

Type: AFNamedCollectionListAFCase
Returns the list of AFCase objects which match the search criteria.

Remarks

A case must be saved to the server using ApplyChanges or CheckIn before it will be returned by this find method. This method will return all cases from the specified time up to the specified maximum count.

Important note Important
Consider using the new AFCaseSearch class for finding cases instead of using this method.

Version Information

AFSDK


See Also

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