9 Replies Latest reply on Jul 20, 2017 1:26 PM by Niranjan032

    Get tag information using Point ID in VBA

    Davidp809

      I am writing a script in excel and need to gather the points Tag name and some recent historical data from that tag. I have not found the documentation for this so even that would help.

        • Re: Get tag information using Point ID in VBA
          Kenji Hashimoto

          For getting tag information, you can use PI SDK or PI API. (Which are old technologies though)

          Using PI SDK from Excel, you need to add PISDK library as reference.

          Open Visual Basic, Tools > Add reference

          Add PISDK 1.3 Type Library

          Following code works.

          Dim myServer As Server
          Dim myTag As PIPoint
          Dim myPointList As PointList
          Set myServer = Servers("PIServerName")
          Set myPointList = myServer.GetPoints("PointID = 4")
          Set myTag = myServer.PIPoints(myPointList.Item(1).Name)
          
          1 of 1 people found this helpful
          • Re: Get tag information using Point ID in VBA
            Niranjan032

            Just wanted to know if I can get PI point using two attributes as reference.

            Example: I have Instrument tag and Tag mask to be given at once and get the respective tags.

             

            For the below code I get PI tags which match the instrument tag

             

            Dim srv As Server

            Dim PointAttri As PointList

            Dim Tag As PIPoint

             

            Set srv = Servers("mntsstee099")

            passstring = "Instrumenttag = 'FUY001'"

            Set PointAttri = srv.GetPoints(passstring)

             

            But I need tags for the above instrument tag and even with the tag mask

            Dim srv As Server

            Dim PointAttri As PointList

            Dim Tag As PIPoint

             

            Set srv = Servers("mneot1254")

            passstring = "Instrumenttag = 'FUY001'"

            TagMask = "Tag = 'sd.dt.*'"

            Set PointAttri = srv.GetPoints(passstring, TagMask )  #This line is giving me error

             

            Could any one help in correcting this line or with the correct syntax for getting PI points using Passstring and Tagmask

            Kenji Hashimoto

            Eugene Lee