4 Replies Latest reply on Feb 11, 2010 2:08 PM by andreas

    Can you determine how a display was opened?

    rmoynes

      A colleague asked me if this was possible.  My Processbook knowledge is a little rusty (remember Windows 3.1?), so I'm asking here.  This is for v3.0.14.3 of Processbook.

       

      He wants to determine how a display was opened (which button got clicked).

       

      Here's what he's trying to do.  We had a display showing general information about one process site, and a single trend.  Call it site1.pdi.  At some point, this display was modified to handle a second site.  The general information for the 2nd site was added to the display, then a copy was made (site2.pdi) and the tags in the single trend were replaced with those for site2.  Typically, users start with a main.pdi that covers all sites, then click on a button (site1, site2) to bring up the books for that site.  These sub-displays then have links to either site1.pdi, or site2.pdi.

       

      We are going to have a 3rd site, so he's added the general information for that site to the display, which is how the clients want it.  Rather than maintain 3 displays with quite a bit of duplicated information, he'd like to have one display (site.pdi) for all 3 sites, that has 3 trends (one for each site), then make the appropriate trend visible based on which button they clicked on.

       

      From what I've seen on here, it looks like ModuleContext and Aliases may be the way to go.  We haven't used those before, so there could be a bit of a learning curve.  Is there a simpler way to achieve what he's trying to do?  He was hoping he could do something like this:

      Private Sub Display_Open()
        If(ProcessBookMagic says site1) Then
          trend1.Visible = True
        ElseIf(ProcessBookMagic says site2) Then
          trend2.Visible = True
        Else
          trend3.Visible = True
        End If
      End Sub

       

        • Re: Can you determine how a display was opened?
          hanyong

          Richard Moynes

          From what I've seen on here, it looks like ModuleContext and Aliases may be the way to go.  We haven't used those before, so there could be a bit of a learning curve.

          Module Relative Displays and Element Relative Displays (introduced in ProcessBook 3.2, works with AF database instead of module database) is the best option, utilizing the existing functionality of ProcessBook. Personally I didn't find it too hard to learn them. You can go through our online courses, available at the Training Center to pick it up. Refer to Chapter 5 of "PI ProcessBook, PI DataLink and RtWebParts" course to learn about module database.

           

          The method using VBA will work as well, you just need to figure out a way to pass the selected site as a variable to site.pdi from main.pdi. One way that I can think of is using a hidden text symbol in site.pdi to store this variable.

            • Re: Can you determine how a display was opened?
              rmoynes

              Han Yong

              Module Relative Displays and Element Relative Displays (introduced in ProcessBook 3.2, works with AF database instead of module database) is the best option, utilizing

               

               

               

              Unfortunately, we don't have AF and we are using v3.0.14.3 of ProcessBook.

               

              I forgot to mention that any solution would have to be maintainable by a non-programmer.  Usually the business unit takes care of Processbooks, but when we met to decide who would create the displays for this new site, we lost.  They will be maintaining them, though.

               

               

               

              My colleague is going to explore passing a variable through VBA some more.  The process engineers have used VBA with Excel before, so this may be the best option for now.

               

               

               

              Thanks,

               

              Richard

               

               

                • Re: Can you determine how a display was opened?

                  Richard Moynes

                  My colleague is going to explore passing a variable through VBA some more.  The process engineers have used VBA with Excel before, so this may be the best option for now.
                  Yes and no...

                   

                  As you first pointed out and then confirmed by Han Yong, the Module-Relative Display (MRD) approach and, in PI ProcessBook 3.2 or later, the Element-Relative Display (ERD) approach definitely are the way to go. However, in our out-of-the-box implementation of MRD/ERD, the user simply gets on the display (a single display for multiple units) and then selects the desired unit from the list - there is no notion of opening a display with a "target unit" in mind.

                   

                  But this is an interesting concept. And I'm wondering if the ProcessBook product manager and the development team already received such requests in the past... off the top of my head, I see 2 ways to implement this:

                  1. Add some "TargetPIModule" or "TargetAFElement" property on the Application class, which would be set programmatically to indicate an MRD or an ERD to open with a specfic unit selected.
                  2. Add a setting to the "Define Button" dialog, where the module/element path is specified and is passed to the display targeted by the ProcessBook button.

                  With that said, I'm afraid your current options are programmatic only... make use of some VBA or a .NET add-in to somehow store the target module/element somewhere and retrieve it at the startup of an MRD/ERD.

                   

                  Feel free to initiate a new discussion thread in this forum if you encounter specific challenges, should you decide to go that route

                  • Re: Can you determine how a display was opened?
                    andreas

                    Richard,

                     

                    not sure if there might be some misunderstanding, Module Relative Displays are available in PB 3.x and do not require AF. Furthermore, if you choose the Module Relative Display you are free to move this to PI WebParts while any VBA solution will be not available in a thin client solution (like PI Webparts).

                     

                    And the best of all - you do not need any programming skills to maintain a module relative display approach.