3 Replies Latest reply on Mar 18, 2009 3:39 PM by RJKSolutions

    PB VBA vs PB Addin with ActiveView

    AlistairFrith

      Our customer wants us to develop a dashboard system to be viewed using ActiveView. I am creating some demo / prototype dashboards using VBA at the moment but would like to do it in a neater fashion if possible. I was wondering what the ActiveView implications would be of developing the dashboard creation code as a ProcessBook addin.

       

      The advantages that I can see are:

      1. I get to code in a better development environment and language of my choice (VBA has many shortcomings, C# and VB .NET are both superior)
      2. The code to generate the displays can be separate from the displays themselves

      The disadvantages are:

      1. I am not as familiar with writing addins as I am with VBA, although I have access to the webinars and VS2005 addin templates.
      2. I do not know if ActiveView is compatible with addins.

      Does activeviewsupport Processbook addins? If not the display creation could be done in PB by an addin for viewing separately in ActiveView but custom behaviour would still have to be created as VBA modules. Could an addin create VBA code modules in the display to implement any custom behaviour? I know I have experienced problems trying to get PB VBA to write code modules since the module being written gets parsed before it is complete and the whole thing falls over. Can an addin get around this by putting PB into build mode while it creates modules?

       

      --- Alistair.

       

       

        • Re: PB VBA vs PB Addin with ActiveView

          @Alistair: PI ActiveView does support PI ProcessBook add-ins; in fact, any add-in developed for PI ProcessBook and set to load and execute on startup, also loads when PI ActiveView starts up. But add-ins written for PI ProcessBook can throw errors or disable themselves in various scenarios. I would suggest you first take a look at the PI ProcessBook Add-ins and PI ActiveView, Making them work together White Paper.

           

          We briefly discussed this paper in our Programming .NET Add-Ins for PI ProcessBook webinar, which you can review as well.

           

          Hope this helps!

            • Re: PB VBA vs PB Addin with ActiveView
              MikeReid

              Sounds like you won't need this option now, but I tend to use VBA code in Excel to automate ProcessBook modifications.

              • This has the advantage of letting you create a list of files, and then apply a standard set of changes to each one in succession.
              • One such application I have used in the past is to load a standard piece of code into each display.
              • The VBE programming environment alows you to edit displays quite explicitly, but I try to make my display code standard anyway.
              • What I do is save the code from a tested display into text files, and then have the VBA copy the text into the display.
                • You can handle the main class, sub-modules, classes etc
                • I can't remember the details, but you do need to delete some of the compiler directives at the start of some file types.
              • I can dig out an example if you need it.
                • Re: PB VBA vs PB Addin with ActiveView

                  Another option if we are talking about common code routines is to have an addin in ProcessBook that hooks into the application object and waits for events, this way common code is only stored in one place but applied to all displays/workbooks.  Gets even better by using .Net methods/functions that are stored in a database and compiled when requested by the addin so you never need to recompile the addin again.

                   

                  Also, have one display (.pdi) that contains all kinds of common routines and have all other displays reference the "common" display to expose all routines (well public routines) to each and every display.