1 Reply Latest reply on Nov 21, 2012 11:10 AM by andreas

    Delete snapshot event

    paulip

      How can I delete snapshot event using PISDK?

       

      The call sPt.Data.RemoveValues() only removes archive events and leave out the snapshot.

        • Re: Delete snapshot event
          andreas

          Paul - what version of PI and what version of the PISDK, and optionaly - what language?

           
                      string myTagName = "LabTag1";
                      
                      PISDK.PISDK myPISDK = new PISDK.PISDK();
                      PISDK.Server myServer = myPISDK.Servers.DefaultServer;
                      PISDK.PIPoint myPIPoint = myServer.PIPoints[myTagName];
          
                      Console.WriteLine("writing...");
                      myPIPoint.Data.UpdateValue(1, "*");
                      System.Threading.Thread.Sleep(1000);
                      Console.WriteLine("{0}: {1}", myPIPoint.Data.Snapshot.TimeStamp.LocalDate, myPIPoint.Data.Snapshot.Value);
                      Console.WriteLine("writing...");
                      myPIPoint.Data.UpdateValue(100, "*");
                      System.Threading.Thread.Sleep(1000);
                      Console.WriteLine("{0}: {1}", myPIPoint.Data.Snapshot.TimeStamp.LocalDate, myPIPoint.Data.Snapshot.Value);
                      Console.WriteLine("writing...");
                      myPIPoint.Data.UpdateValue(1, "*");
                      System.Threading.Thread.Sleep(1000);
                      Console.WriteLine("{0}: {1}", myPIPoint.Data.Snapshot.TimeStamp.LocalDate, myPIPoint.Data.Snapshot.Value);
                      Console.WriteLine("removing...");
                      myPIPoint.Data.RemoveValues(myPIPoint.Data.Snapshot.TimeStamp, "*", PISDK.DataRemovalConstants.drRemoveAll);
                      System.Threading.Thread.Sleep(1000);
                      Console.WriteLine("{0}: {1}", myPIPoint.Data.Snapshot.TimeStamp.LocalDate, myPIPoint.Data.Snapshot.Value);
                      Console.ReadKey();
          

           

           

          the C# code above does exactly what I am expecting:

           

          writing...
          21.11.2012 12:09:08: 1
          writing...
          21.11.2012 12:09:09: 100
          writing...
          21.11.2012 12:09:10: 1
          removing...
          21.11.2012 12:09:09: 100