1 Reply Latest reply on Jul 11, 2017 4:34 AM by Kenji Hashimoto

    Linking an on screen value to a scroll bar


      Hello all,


      I usually try and nut these things out myself but I'm having a Friday moment...


      I have 5 values that are calculated at the PLC end at midnight each night that show a percentage of time that each value (a control constraint) was active. I've made a pie-chart using arcs and scripting, but what I would like to add to this is a scroll bar that the user can move to display the pie-chart for different days.


      The chart sits in a page populated with 'live' data, so using the playback toolbar is not a good option.


      So far I might be headed down the completely wrong track, but I have added a PICALC expression that uses TagVal('tagname','*-xd'). I can manually change the 'x' to 0,1,2,3 etc, but is there a way to link the ScrollBar1 value to the PICALC to fill the 'x'?


      Thanks in advance.

        • Re: Linking an on screen value to a scroll bar
          Kenji Hashimoto

          Since you are using PICALC (Data set), so I guess you are using PI ProcessBook. From VBA, you can change the Dataset expression.

          For example (It changes the dataset expression to cdt158 + sinusoid)

          Dim MyDatasets As Datasets
          Dim MyDataset As Dataset
          Set MyDatasets = ThisDisplay.Datasets
          Set MyDataset = MyDatasets.GetDataset("DS1")
          MyDataset.Expression = "'cdt158' + 'sinusoid'"
          MyDatasets.SetDataset MyDataset

          So it should be possible by VBA to change *-xd part. I am not sure about the scroll bar though.