7 Replies Latest reply on Apr 4, 2017 7:26 PM by Rick Davin

    AFEventFrameSearch and paging

    torsteins

      I'm trying to use AFEventFrameSearch along with pagination. From what I understand this is supposed to work.

       

      AFEventFrameSearch search = new AFEventFrameSearch(database, "EventFrameSearch", AFSearchMode.Inclusive, AFTime.Parse(start), AFTime.Parse(end), query);

      var result = search.FindEventFrames(0, false, 10);

       

      With this i want to have my result have the first page with 10 records from my overall result, but i always get all my results from my search.FindEventFrames(x, x, x) - no matter what parameters i provide.

       

      Am I doing something wrong, or is there a bug in this feature?

       

      AFSDK version 2.8.6.7801

        • Re: AFEventFrameSearch and paging
          Dan Fishman

          Do you iterate over the result or are you just calling a property on the result?  I believe if you iterate over the results you will get the pages as they come available. 

          • Re: AFEventFrameSearch and paging
            Rick Davin

            Hi Torstein,

             

            You're not doing anything wrong. You get an enumerated collection returned you in some given page size.  You probably have a loop involved where you iterate over each returned event frame.  As you iterate through your loop, the FindEventFrame method provides data for the page.  If you loop to a record that would be on the next page, then another page of data is automatically retrieved without you having to do anything special.  If you ever had cause to break out of the loop early, the advantage is that subsequent page fetches will not occur.

             

            One of the many nice things about AFEventFrameSearch.FindEventFrames versus AFEventFrame.FindEventFrames is the looping over pages is done transparently with AFEventFrameSearch and its simple looping mechanism, whereas with AFEventFrame.FindEventFrames it was left to the developer to add a paging loop.  I guess this transparency is what has you confused.  With AFEventFrames.FindEventFrames you fetched exactly one page with a call.  It was up to you to add your own looping mechanism to process more pages usually with the startIndex and maxCount parameters.

             

            Regards,

            Rick

            2 of 2 people found this helpful