5 Replies Latest reply on Mar 25, 2009 10:56 AM by MikeReid

    Trend Value Copier

    MikeReid

      Is there a more up to date Trend Value Copier than the one on DevNet (API based)?

       

       

       

      I have some users desparate for this functionality, but don't want to write it from scratch if I don't need to.

       

      In this context, the users have a lot of DataSets, so I am thinking about getting the data from the trend itslef rather than diretly from PI.

        • Re: Trend Value Copier
          cescamilla

          I checked that application, and this functionality is already included in the latest version (3.1) of PI ProcessBook... I see no need to make a new version of it.

           

          Have you checked that?

           

          Copy-Trend-Value.png

            • Re: Trend Value Copier
              MikeReid

              Yes - there are a lot of nice new features in the latest version, but unfortunately it takes a long time for us to get new software version deployed.

               

               

               

              I've had another look at the code, and the Trend method to get values - I may just give it a try later.

                • Re: Trend Value Copier

                  Mike,

                   

                  Not seen the DevNet one but here is one I just knocked up, you can just build up couple of arrays based on the contents or create an Excel worksheet on the fly.

                   

                  Sub ParseTrendValues(ByVal TheTrend As Trend)

                  Dim T As Integer
                  For T = 1 To TheTrend.TraceCount
                      TheTrend.CurrentTrace = T
                     
                      Dim TV As Long
                      For TV = 1 To TheTrend.TraceValuesCount
                          Dim vTime As Variant, vStatus As Variant, vValue As Variant
                          vValue = TheTrend.GetTraceValue(TV, vTime, vStatus)
                         
                          Debug.Print "Trace " & T & ", Tag:" & TheTrend.GetTagName(T) & ", Value:" & vValue & ", Time:" & vTime & ", Status:" & vStatus
                      Next TV
                  Next T

                  End Sub

                  • Re: Trend Value Copier
                    cescamilla

                    That's really bad, as it is getting older by the second and sure it includes a lot of nice features and then some!

                     

                    Hope you can deploy it soon.

                      • Re: Trend Value Copier
                        MikeReid

                        Nobody tell the boss... but I got bored, so have written most of the code to copy the trend data to the clipboard.

                         

                        The basic functionality works, but I need to sort out the error trapping etc.

                         

                        I can post an example if anyone needs it.