2 Replies Latest reply on Sep 2, 2015 2:18 AM by stang

    PI SDK (VB): Wildcard not accepted in GetPoints?

    bartmch

      Hi everybody,

      Within my VB (actually SVB, Statistica VB) script I'd like to get a list of tags containing the unit name, "". I'd like to do this by using wildcards as shown in the following snippet:

       

      Function ExtractPIData(PiSrvr As PISDK.Server,PItag As String) As Spreadsheet
      
        PItag1 = "UF97000(P_BBBB_AA):B-Report"
        PItag2 = "UF97014*"
        PItag3 = "UF97014*"
        PItag4 = "Tag='UF97000*'"
        PItag5 = "tag='UF97000*'"
      
      
        Dim PiPoints1 As PIPoint
        Dim PiPoints2 As PIPoint
        Dim PiPoints3 As PointList
        Dim PiPoints4 As PointList
        Dim PiPoints5 As PointList
      
      
        Set PiPoints1 = PiSrvr.PIPoints.Item(PItag1)
        Set PiPoints2 = PiSrvr.PIPoints(PItag2)
          Set PiPoints3 = PiSrvr.GetPoints(PItag3)
          Set PiPoints4 = PiSrvr.GetPoints(PItag4)
          Set PiPoints5 = PiSrvr.GetPointsSQL(PItag5)
      

       

      When debugging this would give me:

       

      2: PiPoints1 -> "UF97000(P_BBBB_AA):B-Report"
      2: PiPoints2 -> [PIPoint@Nothing]
      2: PiPoints3 -> [PointList@Nothing]
      2: PiPoints4 -> [PointList@Nothing]
      2: PiPoints5 -> [PointList@Nothing]
      

       

      As expected PiPoints1 is giving me the result I am looking for without using wildcards. Any idea why I'm not getting any tag name for PiPoints4 and PiPoints5?

      Also, I am planning to extract some timeseries data (= compressed data?) based on that tag along with a start and end date using the function "PiPoints1.Data.RecordedValues", would that be feasible?

       

      Thank you,

      Bart

        • Re: PI SDK (VB): Wildcard not accepted in GetPoints?
          Rhys Kirk

          Out of interest, if you perform the same wildcard tag search using the PI SDK dialogs in ProcessBook do you see the same behaviour?

           

          For PItag5 change the search to "tag Like 'UF97000*'"

          • Re: PI SDK (VB): Wildcard not accepted in GetPoints?
            stang

            Hi Bart,

             

            The following worked for me:

             

            Dim srv As Server
            Dim pointest As PIPoint
            Dim listest As PointList
            Dim listest2 As PointList
            
            Set pointest = srv.PIPoints("CDT158")
            Set listest = srv.GetPoints("Tag = 'CD*'")
            Set listest2 = srv.GetPointsSQL("Tag Like 'CD*'")
            
            

             

            So my findings are that:

             

            1. Server.PIPoints cannot accept wildcards.

            2. Server.GetPoints can accept wildcards. In other words, I would have expected your PiPoints4 to have worked.

            3. Server.GetPointsSQL can accept wildcards, but you have to use the syntax as suggested by Rhys.

             

            In summary,

            PiPoints 2 does not work because wildcards are unsupported.

            PiPoints 3 and 5 do not work because of syntax errors.

             

            However, I am not sure why your PiPoints4 is not working. Granted, my tests are all in VBA and I know nothing about SVB. Could you test GetPointsSQL with the correct syntax and see if that works for you?

             

            Edit: Just realized that this is a necropost, but somehow it was shown last active today in my feed. I have marked the question assumed answered due to the long period of inactivity.