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

AF SDK Reference

AFSearch(T).IsMatch Method

  • Last UpdatedJan 12, 2026
  • 3 minute read
AFSearch(T).IsMatch Method
Determines if the specified item matches the search query.

Namespace:  OSIsoft.AF.Search
Assembly:  OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 3.2.0.7

Syntax

public bool IsMatch(
	T item
)
Public Function IsMatch ( 
	item As T
) As Boolean

Dim instance As AFSearch
Dim item As T
Dim returnValue As Boolean

returnValue = instance.IsMatch(item)
public:
virtual bool IsMatch(
	T item
) sealed
abstract IsMatch : 
        item : 'T -> bool 
override IsMatch : 
        item : 'T -> bool 

Parameters

item
Type: T
The item to check against the search query.

Return Value

Type: Boolean
Returns if the specified item matches the search query. Otherwise is returned. If ThrowOnError is and an error is found in the query, then this method will return because the object does not match the query.

Implements

IAFSearchTIsMatch(T)

Exceptions

ExceptionCondition
FormatException This exception is thrown if the ThrowOnError property is and there is a format error in the search query.
NotSupportedException This exception is thrown if the ThrowOnError property is and one of the filters is not supported or the query is too complex to be evaluated by the server.

Remarks

This method will evaluate the search query and determine if the specified item matches the query filters for the search. The ThrowOnError property determines whether an exception is thrown if an error is found in the query.

Examples

 1// Get the Database
 2PISystems myPISystems = new PISystems();
 3PISystem myPISystem = myPISystems.DefaultPISystem;
 4if (myPISystem == null)
 5    throw new InvalidOperationException("Default PISystem was not found.");
 6AFDatabase myDB = myPISystem.Databases[dbName];
 7if (myDB == null)
 8    throw new InvalidOperationException("Database was not found.");
 9
10DateTime startTime = DateTime.Now;
11
12//Create a search to find all elements starting with "MyEvent" in their name
13//and an end date less than or equal to the current time plus 1 hour.
14AFEventFrameSearch search = new AFEventFrameSearch(myDB, "FindEventFrame", @"MyEvent* End:<=*+1h");
15AFEventFrame myEventFrame = new AFEventFrame(myDB, "MyEventFrame");
16myEventFrame.SetStartTime(startTime);
17myEventFrame.SetEndTime(startTime.AddHours(1));
18
19//IsMatch will evaluate to true if the new Element would match the 
20//query supplied in AFSearch above.  This avoids the need for having the SDK
21//do an actual RPC to the server as the match is evaluated on the client.
22bool match = search.IsMatch(myEventFrame);
23
24if (match)
25    Console.WriteLine("Event Frame {0} matched the supplied search query in the {1} search.", myEventFrame.Name, search.SearchName);
26else
27    Console.WriteLine("Event Frame {0} did not match the supplied search query in the {1} search.", myEventFrame.Name, search.SearchName);

Version Information

AFSDK

Supported in: 3.1.1, 3.1.0, 3.0.2, 3.0.1, 3.0.0, 2.10.11, 2.10.5

See Also

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