5 Replies Latest reply on Apr 5, 2017 10:34 PM by Mike Zboray

    Acknowledge event frame via AF SDK

    MikeSpath

      Hello:

      I've done some digging on this but have not found the solution. I'm trying to use the AF SDK (2016) to acknowledge all event frames. I have started by doing the basic search below then to loop through each AFEventFrame but the property is read only. Can you point me the right way?

      Thanks

       

                // Basic Query 
                  string query = "Start:>=*-35d";
                  //search 
                  AFEventFrameSearch search = new AFEventFrameSearch(db, "search", query);
                  MessageBox.Show(string.Format("Total EF match critiera: {0} ", search.GetTotalCount()));
                  IEnumerable<AFEventFrame> eventFameResults = search.FindEventFrames(0, true, int.MaxValue);
                    // pick through Event Frame to test and acknowledge
                  foreach(AFEventFrame ef in eventFameResults)
                  {
                      ef.CaptureValues();
                  }
      
        • Re: Acknowledge event frame via AF SDK
          MikeSpath

          Just to follow up

          I get the following error on the Event frame after trying

           

                        if (ef.CanBeAcknowledged && !ef.IsAcknowledged)
                              ef.Acknowledge("mds", AFTime.Now);
          

           

          Cannot change the 'AcknowledgedBy' property of Event Frame 'Network Node Down 2017-03-07 04:44:52.000' because it is not new.

           

          Any suggestions helpful.

            • Re: Acknowledge event frame via AF SDK
              MikeSpath

              Following up again, the code below will work to blindly ack all event frames (that contain "pH") in search BUT how do I asssign the user and time ack'd??

               

                          //now actually bring back EF and full load- much more expensive call. 
                          IEnumerable<AFEventFrame> eventFameResults = search.FindEventFrames(0, true, int.MaxValue);
                          foreach(AFEventFrame ef in eventFameResults)
                          {
                              if (ef.CanBeAcknowledged && !ef.IsAcknowledged && ef.Name.Contains("pH"))
                              {
                                  MessageBox.Show(ef.Name);
                                  //ef.Acknowledge(@"SPECTRA\mspath", AFTime.Now);  DOES NOT WORK!
                                  ef.Acknowledge(); WORKS but how to assign user and time??
                              }
                          }
              
            • Re: Acknowledge event frame via AF SDK
              gachen

              Hi Mike,

               

              The user and the time of the acknowledgment are not exposed as user-settable fields and are set transparently for you via the call to AFEventFrame.Acknowledge() based on the calling user's security principal and the current time that the method is called. As the remarks of AFEventFrame.Acknowledge state:

              This method will set the IsAcknowledged, AcknowledgedBy, and AcknowledgedDate properties.

               

              Edit:

              Apparently I am going blind. I did not see that the method has acknowledgedBy and acknowledgeDate as optional parameters. The above statement is true if none of the optional parameters are supplied. Otherwise, as Rick mentions, you can only supply these if the Event Frame is new (i.e. is a new AF object and has not been checked in yet). When not supplying the optional parameters, you can acknowledge the Event Frame anytime after the Event Frame has been checked in, and it has not been previously acknowledged. I suppose the design decision of requiring the Event Frame to be new when using manually supplied users and times is for backwards compatibility, as I think Mike Zboray is stating.