AnsweredAssumed Answered

AFEventFrameSearch - Last Item

Question asked by brendanbell on Sep 29, 2017
Latest reply on Sep 29, 2017 by rdavin

I am converting some code over from some legacy applications to use the new AFSearch classes.

My use case is: I want to find the latest EventFrame (most recent StartTime) for a given Element and Event Frame Category.

 

Legacy code allowed me to perform an Element.GetEventFrames(...) sort descending on StartTime and MaxCount of 1.

 

Its not immediately obvious to me if this same functionality is available.

string query = string.Format("Element:{0} Category:{1}", element.GetPath(database), myCategory);
var search = new AFEventFrameSearch(database, "my search", AFSearchMode.StartInclusive, new AFTime( "1/1/2000"),new AFTime("*"), query);
IEnumerable<AFEventFrame> frames = search.FindEventFrames(startIndex: 0, fullLoad: false, pageSize: 1);
???

Outcomes