2 Replies Latest reply on Oct 15, 2009 7:20 PM by CalebH

    ProcessBook Add-In - limitation of GetTraceValue ?


        I was wondering if there is a limitation on the PBSymLib.Trend object as far as calling

      GetTraceValue(nValueIndex, vrTimeOfValue, vrStatus)
        When I cycle through the traces on a Trend object that has more than 26 traces, every tag starting with the 27th trace will error with:


      "Run-time exception thrown : System.Runtime.InteropServices.COMException - Number submitted was outside of acceptable range for the value."


        Also confirmed that error when trying to create Watch values for any trace number past 26.  When adding tags to a trend in ProcessBook, though, it says the limit is 50 tags.  Are these numbers supposed to match?  How can I call GetTraceValue(...) on the remaining 24 traces?


        There aren't any problems with the tags as they plot properly and if I delete the 27th trace, the "new" 27th trace is the first one to error.  These are all analog tags.


        I am using ProcessBook v3.0.15.7 with PI-SDK, Visual Basic 2008.



        • Re: ProcessBook Add-In - limitation of GetTraceValue ?
          Daniel Takara



          GetTraceValue actually returns the requested value for the CurrentTrace. So, I believe that what's happening is that the current trace on your trend has only 26 values and you are getting an exception when trying to access the 27th value (which actually does not exist).


          If you want to iterate through the traces on the trend, you may want to use something like the code below. In this example, you would get successive message boxes with the value of the last value of each trace defined in the trend.

          Sub Test1()
              Dim i As Integer
              Dim tvc As Integer
              Dim dt As Date
              Dim st As Integer

              For i = 1 To Trend1.TraceCount
                  Trend1.CurrentTrace = i
                  tvc = Trend1.TraceValuesCount
                  MsgBox ("Last value of trace " & CStr(i) & " is " & CStr(Trend1.GetTraceValue(tvc, dt, st)))
              Next i
          End Sub