As per our requirement we need to know the history of a notification for a database, total count for that period and the last time when the notification occurred….
We are using below code snippet for it …
ANNotificationList notificationList = new ANNotificationList(AFNotification.FindNotifications(this.Database, null, AFSearchField.Name, AFSortField.Name, AFSortOrder.Ascending, 100));
List<ANNotificationInstances> notificationInstances = notificationList.GetInstances(new AFTime(startTime));
foreach (ANNotificationInstances instances in notificationInstances)
AFNotification notification = AFNotification.FindNotification(this.pISystem, instances.NotificationID);
if (notification != null)
name = notification.Name;
if (instances.Count > 0)
lastFired=instances.Instances[instances.Count - 1].StartTime.ToString();
//count=instances.Instances[instances.Count - 1].NewTriggerEvents.Count.ToString();
Here If We give the start time as yesterday(3/14/2012), its gives us the below result :
Name = TestNotification1, Count = 1, lastFired = 2/16/2012 7:37:06 AM
But We can see the last notification occurred at 3/15/2012 10:35:06 AM and also if we are searching based on timeframe it should show the lastFired result in that given timeframe only and also the NewTriggerEvents Count is 4100.
Could you please let us know why it’s showing different result and also what NewTriggerEvents do?
Appreciate yours assistance on it!!!