AFNotification.FindNotifications Method (AFDatabase, String, String, AFCategory, AFElementTemplate, AFElement, AFContact, AFStatus, AFSortField, AFSortOrder, Int32)
- Last UpdatedNov 18, 2025
- 8 minute read
- PI System
- AF SDK 2024 R2
- Developer
Namespace: OSIsoft.AF.Notification
Assembly: OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 3.1.1.1182
Syntax
public static AFNamedCollectionList<AFNotification> FindNotifications( AFDatabase database, string nameFilter, string descriptionFilter, AFCategory elemCategory, AFElementTemplate elemTemplate, AFElement target, AFContact contact, AFStatus status, AFSortField sortField, AFSortOrder sortOrder, int maxCount )
Public Shared Function FindNotifications ( database As AFDatabase, nameFilter As String, descriptionFilter As String, elemCategory As AFCategory, elemTemplate As AFElementTemplate, target As AFElement, contact As AFContact, status As AFStatus, sortField As AFSortField, sortOrder As AFSortOrder, maxCount As Integer ) As AFNamedCollectionList(Of AFNotification) Dim database As AFDatabase Dim nameFilter As String Dim descriptionFilter As String Dim elemCategory As AFCategory Dim elemTemplate As AFElementTemplate Dim target As AFElement Dim contact As AFContact Dim status As AFStatus Dim sortField As AFSortField Dim sortOrder As AFSortOrder Dim maxCount As Integer Dim returnValue As AFNamedCollectionList(Of AFNotification) returnValue = AFNotification.FindNotifications(database, nameFilter, descriptionFilter, elemCategory, elemTemplate, target, contact, status, sortField, sortOrder, maxCount)
public: static AFNamedCollectionList<AFNotification^>^ FindNotifications( AFDatabase^ database, String^ nameFilter, String^ descriptionFilter, AFCategory^ elemCategory, AFElementTemplate^ elemTemplate, AFElement^ target, AFContact^ contact, AFStatus status, AFSortField sortField, AFSortOrder sortOrder, int maxCount )
static member FindNotifications : database : AFDatabase * nameFilter : string * descriptionFilter : string * elemCategory : AFCategory * elemTemplate : AFElementTemplate * target : AFElement * contact : AFContact * status : AFStatus * sortField : AFSortField * sortOrder : AFSortOrder * maxCount : int -> AFNamedCollectionList<AFNotification>
Parameters
- database
- Type: OSIsoft.AFAFDatabase
The AFDatabase to search for the requested objects. - 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'.
- descriptionFilter
- Type: SystemString
The description 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 notifications must have this category. To not filter by element category, then specify for this parameter. - elemTemplate
- Type: OSIsoft.AF.AssetAFElementTemplate
Specify that returned notifications must have this template or a template derived from this template. You can specify None to return notifications that do not have any template. To not filter by element template, then specify for this parameter. - target
- Type: OSIsoft.AF.AssetAFElement
The AFElement that is the target of the analysis of the desired AFNotification objects. - contact
- Type: OSIsoft.AFAFContact
The AFContact that is to receive the desired AFNotification objects. - status
- Type: OSIsoft.AF.AnalysisAFStatus
The Status of the desired AFNotification objects must match this status. Specify None to not search by status. - sortField
- Type: OSIsoft.AFAFSortField
The field or property of the object used to sort the returned collection. - sortOrder
- Type: OSIsoft.AFAFSortOrder
The order that the returned collection is sorted. - maxCount
- Type: SystemInt32
The maximum number of objects to be returned.
Return Value
Type: AFNamedCollectionListAFNotificationReturns a collection containing the first page of AFNotification objects which match the specified nameFilter string and filters.
Remarks
Examples
// Loading a list of Notifications for display is a common task whose performance can be // greatly improved by using bulk retrieval methods.Notifications typically reference several other top-level // AF Objects, such as Analyses, Analysis Templates, Elements, Element Templates, and Element paths. // This example uses several methods to illustrate how to load such a list. // Get the Default Database PISystems myPISystems = new PISystems(); AFDatabase myDB = myPISystems.DefaultPISystem.Databases.DefaultDatabase; if (myDB == null) throw new InvalidOperationException("Database was not found."); // Find notifications to load. As with all top-level objects, the // notifications returned are only partially loaded into memory. AFNamedCollectionList<AFNotification> notifications = AFNotification.FindNotifications(myDB, "", AFSearchField.Name, AFSortField.Name, AFSortOrder.Ascending, 100); // The LoadNotifications call will fully load the notification into memory. // The second parameter indicates whether the analysis should be loaded as well. // For example, if you were going to display or edit analysis information, you would // set this parameter to true. AFNotification.LoadNotifications(notifications, false); // Notifications target other AFObjects. We can cause those to be loaded via this call. // Note that typically, notifications target single AFElements, however, in the future, // there may be other types of objects targeted. IList<object> targets = AFNotification.LoadTargets(notifications, false); // Now output the notifications. There should be no more calls to the server at this point. foreach (AFNotification notification in notifications) { AFObject target = notification.Target as AFObject; if (target != null) Console.WriteLine("{0}: {1}", notification, target.GetPath()); else Console.WriteLine("{0}: {1}", notification, notification.Target); }
' Loading a list of Notifications for display is a common task whose performance can be ' greatly improved by using bulk retrieval methods.Notifications typically reference several other top-level ' AF Objects, such as Analyses, Analysis Templates, Elements, Element Templates, and Element paths. ' This example uses several methods to illustrate how to load such a list. ' Get the Default Database Dim myPISystems As New PISystems() Dim myDB As AFDatabase = myPISystems.DefaultPISystem.Databases.DefaultDatabase If myDB Is Nothing Then Throw New InvalidOperationException("Database was not found.") End If ' Find notifications to load. As with all top-level objects, the ' notifications returned are only partially loaded into memory. Dim notifications As AFNamedCollectionList(Of AFNotification) = AFNotification.FindNotifications(myDB, "", AFSearchField.Name, AFSortField.Name, AFSortOrder.Ascending, 100) ' The LoadNotifications call will fully load the notification into memory. ' The second parameter indicates whether the analysis should be loaded as well. ' For example, if you were going to display or edit analysis information, you would ' set this parameter to true. AFNotification.LoadNotifications(notifications, False) ' Notifications target other AFObjects. We can cause those to be loaded via this call. ' Note that typically, notifications target single AFElements, however, in the future, ' there may be other types of objects targeted. Dim targets As IList(Of Object) = AFNotification.LoadTargets(notifications, False) ' Now output the notifications. There should be no more calls to the server at this point. For Each notification As AFNotification In notifications Dim target As AFObject = TryCast(notification.Target, AFObject) If target IsNot Nothing Then Console.WriteLine("{0}: {1}", notification, target.GetPath()) Else Console.WriteLine("{0}: {1}", notification, notification.Target) End If Next
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.