1 Reply Latest reply on Jan 21, 2011 11:08 AM by andreas

    Setting Trend Time Range from Batch Point in ProcessBook

    mikeloria

      Can someone please provide an example of how to use a unit batch time range to set a trend range. I realize that batchview exists and I have used it. I wanted to provide my customers with a simple text box in which they enter in the batch ID, click a button, and then the trend range automatically updates. I would also like to extend the time interval of the unit batch by an interval of specified time (x time before the begin time, y time after the end time). I was going to provide text boxes that will default to a time to extend but can be changed by the user.

       

      I thing everything I am asking for is in the batchview search. I just would like to create my own display without showing the batchview control. Maybe the batchview control can be hidden and written to in VBA?

       

      Thank you in advance for your kindly suggestions and possible examples.

        • Re: Setting Trend Time Range from Batch Point in ProcessBook
          andreas

          Are you looking for something like this:

           
              Dim MyPIServer As Server
              
              Set MyPIServer = PISDK.Servers.DefaultServer
              
              Dim MyBatchList As PIBatchList
              Set MyBatchList = MyPIServer.PIBatchDB.PIBatchSearch( _
                                      "*-100d", _
                                      "*", _
                                      ThisDisplay.TextBox1.Text)
              
              If MyBatchList.Count > 0 Then
          
                  Call ThisDisplay.Trend1.SetTimeRange( _
                          MyBatchList.Item(1).StartTime.LocalDate _
                              & ThisDisplay.TextBox2.Text, _
                          MyBatchList.Item(1).EndTime.LocalDate _
                              & ThisDisplay.TextBox3.Text)
                              
              End If
          

           

           

          Textbox1 contains the BatchID, TextBox2 the time prior, TextBox3 the time after the batch.