5 Replies Latest reply on Jul 2, 2013 6:06 PM by Gregor

    Getting PI Points providing a list of PointID's in AF SDK RDA

    luis.chaylian

      Is there is a method to get a list of PIPoints providing a list of point ID’s?

       

      Similar to  FindPIPoint(PIServer,Int32) but for a list of PI Points.

       

      thanks

        • Re: Getting PI Points providing a list of PointID's in AF SDK RDA

          Hello Luis,

           

          Please review this example and let us know if it is what you are looking for: 

           
          Imports PISDK
          Imports PISDKCommon
          
          Module Module1
              Sub Main()
                  Try
                      Dim mySDK As New PISDK.PISDK
                      Dim mySrv As Server = mySDK.Servers.DefaultServer
                      Dim myPoints As PISDK.PointList
                      Dim myPointID As PointAttribute
                      mySrv.Open()
                      myPoints = mySrv.GetPoints("tag='s*'", Nothing)
                      For Each myPoint As PIPoint In myPoints
                          myPointID = myPoint.PointAttributes("pointid")
                          Console.WriteLine(myPoint.Name & " has ID: " & myPointID.Value.ToString())
                      Next
                  Catch ex As Exception
                      Console.WriteLine(ex.Message)
                  End Try
                  Console.WriteLine("Press any key to quit ...")
                  Console.ReadKey()
              End Sub
          End Module
          

           

          • Re: Getting PI Points providing a list of PointID's in AF SDK RDA
            luis.chaylian

            Hi Gregor,

             

            It is a little bit different, I want to obtain PIPoints providing a list of pointID's using AF SDK RDA. similar to FindPIPoint("mypiserver",123) does, but providing a list of pointID's.

             

            I was looking for PIPoint.FindPIPoints Method but I didn't see the option using a list of pointID's.

             

            thanks

              • Re: Getting PI Points providing a list of PointID's in AF SDK RDA
                cmanhard

                You can just build a list of points using PIPointList by adding them individually using the FindPIPoints(PIServer, int pointID) method.  Points added by ID are not resolved at the time this constructor is used, so this mechanism is fast.

                 

                Once you have the list of points, you should resolve them in bulk.  The easiest way to do that is use any of the PIPointList methods, such as Snapshot().  The bulk Snapshot() call will also allow you to find any points not resolved via the .Errors collection returned.  A word of caution - the points will not have the tag name loaded by default - so if you ask for the point.Name it will cause an RPC.  To load the tag names in bulk, use PIPointList.LoadAttributes(PICommonPointAttributes.Tag,PICommonPointAttributes.PointType).  You may wish to load other attributes at this time as well - in particular the Step attribute is used often with AF itself for Formula calculations.

                 

                Note that the PIPointList.LoadAttributes method in the 2.5.x release does not return individual errors like the data calls (like PIPointList.Snapshot()), so for most situations, LoadAttributes alone is not sufficient unless you know that all ID's will resolve.