Reading several PI points in once call.

I need to read serveral PI points values at one call. I need to read the values for certain tags only and not all the points. However, I keep on getting an exceptioon that 'tag' attriubte is duplicated.

 

Below is the code I'm using.

 

 

    Dim myPIserver As PIServer = Nothing

 

    Dim startTime As String = ""

    Dim endTime As String = ""

    Dim fltrExp As String = ""

    Dim filtered As Boolean = True

 

    'connection to PI server 

    If myPIserver Is Nothing Then

      myPIserver = New PIServers().DefaultPIServer

    End If

 

    'Query for PI Point 

 

    Dim tagMasks() As String = {"tag1", "tag2", "tag3"}

 

    Dim ptQuery As New List(Of PIPointQuery)()

    Dim tags = ""

 

 

 

    For Each item As String In tagMasks

      ptQuery.Add(New PIPointQuery(attributeName:=PICommonPointAttributes.Tag, AFSearchOperator.Equal, item))

 

    Next

 

    ' Dim myPointList As New PIPointList(OSIsoft.AF.PI.PIPoint.FindPIPoints(myPIserver, ptQuery))

    Dim myPointList As New PIPointList(PIPoint.FindPIPoints(myPIserver, ptQuery))

 

 

    startTime = "*-7d"

    endTime = "*"

 

    'Retrieve events using PIPointList.RecordedValues into list 'myAFvalues' 

    Dim myAFvalues As List(Of AFValues) = myPointList.RecordedValues(New AFTimeRange(startTime, endTime), AFBoundaryType.Inside, "", filtered, New PIPagingConfiguration(PIPageType.EventCount, 10000)).ToList()

 

 

 

 

Parents Reply Children
No Data