3 Replies Latest reply on Oct 22, 2009 5:54 AM by inform2prabhat

    PISDK / AFSDK examples in C#.net

    inform2prabhat

      Hi,

       

      I am struggling with PISDK / AFSDK by using C#.net for accessing different functions like Storing Data into PIArchive, Searching Attribute of a Element in AF etc.

       

      I am not able to find any example with C#.net . PI-SDK.chm is having examples called C# Tutorial Code – CSharpSnapshot which is only related to tag search and get value of a PI Tag. Most of the examples are in VB 6.

       

      Great if anybody can help me out with some more functions of PISDK and AFSDK using C#.net.

       

      I think OSI should release PISDK with dotnet examples also :-) what you say ?

       

      Thanks,

       

      Prabhat

        • Re: PISDK / AFSDK examples in C#.net
          cmanhard

          Regarding AFSDK, there are examples in the AFSDK Reference Help File - and they are provided in both C# and VB.NET.  Typically, there is one example in each class, as well as some more function specific examples in the Contents/Examples chapter.  The section "Examples\Bulk Load Example\Loading Partial Elements" example illustrates invoking the FindElementByAttribute call.

            • Re: PISDK / AFSDK examples in C#.net

              And regarding PI SDK, I guess you're are the right place! (this very forum ) If you search for keywords using the "search" box in the top-right corner, chances are you'll find posts on what you're looking for, as somebody may have asked the question. If you don't, then don't hesitate to start a new discussion thread.

               

              As for the specific use case you mentioned (Storing Data into PIArchive), this is done through the PIData.UpdateValue and PIData.UpdateValues methods. As an example, the following code writes a value of 222 at the current time, for the PI Point named "cdt158". It will write the value regardless of if a value already exists at that time (dmInsertDuplicates) and will do so in a synchronous manner (AsynchStatus == null).

              PISDK.PIPoint pt = myServer.PIPoints["cdt158"];
              pt.Data.UpdateValue(222, "*", PISDK.DataMergeConstants.dmInsertDuplicates , null);

              To make use of the UpdateValues method, you'll have to make use of a PISDK.PIValues collection; let us know if you need further assistance on that one.