2 Replies Latest reply on Dec 17, 2014 8:22 PM by alkarim.samji

    How to insert new value through AFSDK

    alkarim.samji

      Hello,

       

      I'm trying to insert a new value through the AFSDK on a PI point data reference. The value, even when specified at a different timestamp is replaced by the SDK. I'm aiming to have a new value inserted. Here's a code snippet:

       

      OSIsoft.AF.Time.AFTime Timestamp = new OSIsoft.AF.Time.AFTime(DateTime.Now);

      AFValue AV_BadCount = new AFValue(BadCount, Timestamp);

      if (e.Attributes["Bad Count"].RawPIPoint != null)

      {

           OSIsoft.AF.PI.PIPoint.FindPIPoint(e.Attributes["Bad Count"].RawPIPointPath(AFEncodeType.Name)).UpdateValue(AV_BadCount, OSIsoft.AF.Data.AFUpdateOption.Insert);

      }

      else

      {

           e.Attributes["Bad Count"].SetValue(AV_BadCount);

      }

       

      Any help would be appreciated.

       

      Thanks