SunilGajjarH

AFSDK afDB.FindChangedItems(AFIdentity.EventFrame, false, 1000, dbCookie, out dbNextCookie); is not working

Discussion created by SunilGajjarH on Apr 5, 2020
Latest reply on Apr 6, 2020 by Dan Fishman

Hello,

I am facing strange issue on AFSDK method "FindChangedItems" for finding changed EventFrames.

This function is working perfect one AF Server, but it is not working on other AFServer.

Let me explain you in detail,

When I try to see all event frames using PISystem Explorer, I can see hundreds of EventFrames in last couple of months.

 

But, when I try with AFSDK function FindChangedItems() nothing is returned (0 value). This function returns perfect data for rest of AFServers. Apart from that, when I tried to check associated EventFrame not from Database level but at Element level it returns values.

[Screen 2 – Code : Returns 0 Change in event frames at AF database level]

PISystems myPISystems = new PISystems();

PISystem server = myPISystems[txtAFServer.Text];

AFDatabase afDB = server.Databases[txtDatabase.Text];

int days = Int32.Parse(txtDays.Text);

 

lstLog.Items.Add("Initlization...");

 

object dbCookie, dbNextCookie;

dbCookie = new AFTime(DateTime.Now.AddDays(-1 * days)).UtcTime;

 

lstLog.Items.Add("Start Time = " + dbCookie.ToString());

var results = afDB.FindChangedItems(AFIdentity.EventFrame, false, 1000, dbCookie, out dbNextCookie);

lstLog.Items.Add("Event Frame Found = " + results.Count.ToString());

 

 

[Screen 3 – Code: Returns all elements with number of event frames]

var result = element.GetEventFrames("*", 0, 1000, AFEventFrameSearchMode.BackwardFromStartTime, "", null, null);

lstLog.Items.Add(element.GetPath()+ "["+result.Count.ToString()+"]");

 

 

[Screen 4 – Code: Returns all event frames for one element]

AFNamedCollectionList<AFEventFrame> lst = selEle.GetEventFrames("*", 0, 1000, AFEventFrameSearchMode.BackwardFromStartTime, "", null, null);

foreach (AFEventFrame a in lst)

{

lstLog.Items.Add("Temp = " + a.Template.Name+ " , Desc = " + a.Description + " , Time = " + a.StartTime.ToString() +" -> "+ a.EndTime.ToString() + ", ID " + a.ID);

}

Attachments

Outcomes