11 Replies Latest reply on Jul 31, 2013 4:22 PM by viletbounnam

    Playback functionality for ActiveX controls



      I'm developing an ActiveX control that must act like a symbol. When the user starts the PB's playback functionality, it sets the StartTime and EndTime properties from all symbols in the active display throught the SetTimeRange call. As documented on the PB VBA reference, the display's SetTimeRange method don't sets it's StartTime and EndTime properties, just the symbols. Because of this, I can't use the display's properties to simulate the playback onto my ActiveX control. I tried to create the SetTimeRange in the control but the PB ignores it.


      There is any way to my control work with the playback?





        • Re: Playback functionality for ActiveX controls



          here is a very simple example:


          Private Sub Display_Open()


          value1.DisplayTimeStamp = ThisDisplay.EndTime


          End Sub


          background: I have a trend and a value, I need to let the value could be changed with the same time of the trend.  You could see, the above is a very simple to let the value's timestamp equal to the current display's endtime.  it works.  the value's timestamp could be changed when drag the playback bar.  You could use this idea to try your ActiveX control.


          Xi Wang

            • Re: Playback functionality for ActiveX controls

              Thanks for the awnser.


              I tried to use the display's EndTime property but when I start a playback the PB don't set the property value. It keeps the old value while playing.


              The VBA reference says that the Display's SetTimeRange don't sets the properties values.


              There is any object in PB API which I can query the playback information (like the playback time)?

                • Re: Playback functionality for ActiveX controls

                  Hi Orlando,


                  Are you updating the time setting of your control whenever the Display_TimeRangeChange event is triggered? From what I've tested, it seems like when the playback add-in is "playing", the event is triggered and you should be able to get the updated end time for the display timerange.


                  What I think you might have to pay attention to is that you might get a time in PI Time format like '*' for current time or 't' for today from Display.EndTime property. This means that you might have to translate these PI Time to standard time format that your control can interpret. May be a good idea to reference PITimeServer library and use it to convert the time if necessary.

                    • Re: Playback functionality for ActiveX controls

                      Hi Han Yong


                      I can't find this event in my PB. Is it available on the PB 3.3?


                      I'm using PB 3.2 for the development.

                        • Re: Playback functionality for ActiveX controls

                          Hello Orlando,


                          I can confirm your observation. The Display_TimeRangeChange event doesn't exist in ProcessBook 3.2

                            • Re: Playback functionality for ActiveX controls

                              In PB 3.3, Display_TimeRangeChange was added along with the functions Display.UTCStartTime and Display.UTCEndTime to help with these issues.  The latter 2 will return the UTC time as decimals so that you don't have to convert things like "*-8h" and will also return the ACTUAL time range of the display as opposed to the CONFIGURED time.

                                • Re: Playback functionality for ActiveX controls

                                  @Dave: Thanks for adding the info.


                                  @Orlando: It didn't occur to me that the event is not available in the older version. Sorry for that. It does seems like the event will be useful for you, if you are able to use ProcessBook 3.3

                                    • Re: Playback functionality for ActiveX controls

                                      Thanks everyone for the help


                                      I installed the PB 3.3 and implemented the TimeRangeChanged event callback in my ActiveX control. It worked but I observed that the PB don't passes the playback timestamp when the display has no symbols.


                                      This is a message box created on the event callback which displays the StartTime and EndTime parameters. This first screenshot is when my display has no symbols.




                                      And this is when I add a value to display



                                        • Re: Playback functionality for ActiveX controls

                                          @Orlando: I am using PI ProcessBook 2012 (version and the TimeRangeChange event returned me a '*' for each start time and end time argument when no symbols are placed on my display. If I have at least one, I will get the date value for the end time.


                                          Just to give some explanations, the StartTime property of a Display object returns the beginning time for one symbol in the display. The symbol will be the first symbol with a start time. The EndTime property gets the end time for the first symbol in the display that has both a start and an end time. Not all symbols have a StartTime property; Trends have start and end times, Bars, Values and MultiState symbols have an end time only. Symbol that does not have a start time, such as a Value, Symbol.StartTime returns an empty string.


                                          Simply assume that when you receive an empty string or null in your case for the start time, this means you need to read the end time because you are handling a symbol that does not have a start time.


                                          I hope this helped!

                                            • Re: Playback functionality for ActiveX controls

                                              The concept of a display time range is a little odd since technically symbols have time ranges but displays do not.  This is complicated even further by the fact that singletons (bar, value, multistate) don't have a start time because they only show one value (usually at *), so there really isn't a time range associated with them.


                                              Here's the logic that PB uses to determine the time range for a display (this is directly from my recollection, so some details might not be accurate):


                                              1. If there is a Trend, XYPlot, or SQCSymbol on the display, the symbol with the lowest zorder is used (typically this is the first symbol of this type that was created on the display), but this might change if you use Arrange->Send To Back or Arrange->Bring To Front.  In addition, plot symbols which do not have a trace that have a valid clocksource are ignored because we cannot do time conversion on them (this would include a trend with all ODBC traces or AF Constant Attributes, etc).


                                              2. If there is no such plot symbol to use, the lowest zorder singleton that has a valid clocksource is used.


                                              Since this logic is so complex, in PB 3.3 we added the Display.DisplayTimeZoneInfo method.  This will return the PI server (clocksource) being used along with the display start and end time both as a string and as UTC.



                                                • Re: Playback functionality for ActiveX controls

                                                  Orlando I'm also looking into creating an activeX control that behaves like a dynamic symbol for processbook.  Would you be able to post some code to help me get started?  So far I'm following the suggestion from this thread vcampus.osisoft.com/.../1954.aspx


                                                  I've gotten the CSActiveX sample from the microsoft all in one code framework to build and able to use the control in PB.  The next step, and the one I'm confused about is how I would get the tag values to display in my control.  Any help is greatly appreciated.