2 Replies Latest reply on Apr 12, 2018 1:29 AM by Muthulingam-EnQuest

    How to Close a specific PI ProcessBook Display Page using VBA Command?

    Muthulingam-EnQuest

      Hi guys,

       

      - What is the VBA Command to Close a Specific PI ProcessBook Page?

       

      I need to Open and Close a Specific PI ProcessBook Page cyclically in order to refresh the Data Set Calculations in that page.

      I am currently using the following command to run the Slideshow in a Loop. The slideshow is working fine, but the Data-Set Calculations doesn't seem to be refreshing as it should.

      Refer to the "Hours Open" Data Sets below.

       

      Page Open always: The "Hours Open" Data-sets are Not showing similar Values (Not OK)

       

      After Closing and Opening: The "Hours Open" Data-sets are showing similar values (OK)

       

      It was meant to show how many hours the Wellheads are "Open" from 6.00 am to 6.00 pm (24 hrs) everyday. It only refreshes accurately if I close the Page and Re-Open it.

      If not refreshed, they show a different value for each Open Wellhead, this should not be the case as most of the Wellheads are running at a similar time frame.

      Some Wellheads are genuinely Turned On or Off, but most are running concurrently.

       

      All the Data-sets are programmed exactly identical with similar Refresh Rates and Calculation Intervals.

       

      10  Set x = Application.Displays.Open("\\klpi01\Graphics\PM8E-PVDS.pdi", True)

          'Starts the First loop

          PauseTime = 10    ' Set duration.

          Start = Timer    ' Set start time.

          Do While Timer < Start + PauseTime

              DoEvents    ' Yield to other processes.

          Loop

          Finish = Timer    ' Set end time.

               

          Set x = Application.Displays.Open("\\klpi01\Graphics\SEDWellheadMonitoring.pdi", True)

          'Starts the Second loop

          PauseTime = 5    ' Set duration.

          Start = Timer    ' Set start time.

          Do While Timer < Start + PauseTime

              DoEvents    ' Yield to other processes.

          Loop

          Finish = Timer    ' Set end time.

         

          GoTo 10

       

      I've tried multiple VBA Code like:

       

      • Application.Displays.Close("\\klpi01\Graphics\PM8E-PVDS.pdi", True)
      • ThisDisplay.Close
      • ThisDisplay.Close (False)

       

      but the Data sets are still not refreshed as it should have been.

      Please help guys.

       

      Best Regards,

       

      Muthulingam Ramiah

       

      Ganesh Supromaniam

      Muthulingam Ramiah

        • Re: How to Close a specific PI ProcessBook Display Page using VBA Command?
          rschmitz

          Hi Muthulingam,

           

          I took a look through the some of the work items for Processbook and I see that refresh rates for Datasets cannot be less than 1 minute prior to Processbook 2015 R2 as described here. Can you confirm you're running at least that version or newer so we can rule out that as an issue.

           

          The other thing that may be of interest to you I found in the Processbook Programmer Reference guide there appears to be a "Dataset.Refresh" method, which may do what you need without forcing the display closed and opened again.

           

          Cheers,

          Rob

          1 of 1 people found this helpful
            • Re: How to Close a specific PI ProcessBook Display Page using VBA Command?
              Muthulingam-EnQuest

              Hi Robert,

               

              I've changed the refresh rate back to 1 minute now. It works better now without having to close and open the page.

              Our current ProcessBook versions:

              Server End: PI ProcessBook 2009 (Version 3.2.0.0)

               

              Client End: PI ProcessBook 2015 SP2 (Version 3.6.0.82)

               

               

              The Page was made with PI ProcessBook 2015 SP@ on the client side, but later uploaded into the PI Server.

              This shouldn't be an issue right?

               

              I will upgrade the PI ProcessBook on the Server end soon.

              Thank you again Robert.

               

              Best Regards.

               

              Muthulingam Ramiah