5 Replies Latest reply on Dec 18, 2013 9:27 AM by Asle Frantzen

    Reusing same VBA code on multiple ProcessBook displays

    fbatista

      Hello everyone,

       

      I have a ProcessBook display with VBA code that will be used to bring values from a set of tags. The same display could be used to see values from other sets of tags (similar in nature). The simpler solution is just to make copies of the original display and change the tag references in them. However, this solution is not very scalable because whenever I need to perform changes on the code of one display, I would have to do the same in the other derived displays. It just would be hard to maintain.

       

      Using add-in is not an option for me, because it would require IT to allow me to register the addin on all client machines. I prefer to try to accomodate my application on current IT scenario.

       

      The solution of replacing the tag name on the fly would not make the display very responsive. I have more than 300 dynamic symbols using AF data references, and it would just take a few seconds to happen, what would negatively affect the user experience.

       

      I also found that I could create a .bas file to load my code on wharever display I open, but that would require the users to always have another file with the PB file.

       

      Is there a way to have my code at the Workbook level or can create modules that could be shared among different PB files? Does anyone see another solution?

       

      Regards,

       

      Fabiano

       

       

       

       

       

       

        • Re: Reusing same VBA code on multiple ProcessBook displays
          Asle Frantzen

          Fabiano Batista

          ...The solution of replacing the tag name on the fly would not make the display very responsive...

           

           

           

          I just have to ask - aren't you using the Element Relative Displays (ERD) feature, so that the tag/attribute lookup is done by ProcessBook?

            • Re: Reusing same VBA code on multiple ProcessBook displays
              fbatista

              No, in this display I am not using the ERD feature, because each dynamic element is retrieving one attribute per asset. I have more than 300 hundred assets. If I create different AF elements to allow the display to switch contexts, it would mean that whenever a new element is added to the structure, I would have to update the AF elements used for view context switching. This would be hard to maintain.

                • Re: Reusing same VBA code on multiple ProcessBook displays
                  Asle Frantzen

                  Can't you use the same AF element for view context switching?

                   

                  We're doing this for a T&D client, where we have ~11k elements in the 'Equipment repository' sorted by their 6 different equipment types. And references to all of these are also made into the 'Geo hierarchy' where they can be browsed per physical location.

                   

                   

                   

                  You say your focus is on the user experience, making sure the system is responsive. That often means you would have to spend a little more time on maintaining/preparing the data.

                    • Re: Reusing same VBA code on multiple ProcessBook displays
                      fbatista

                      Hi Asle,

                       

                      Yes, I agree that using ERD would be the ideal scenario, but in this case I would have to create 5 elements with 300 attributes each. Each of these 5 elements would represent a type of measure I want to show, and the 300 attributes would be associated with tag per asset. Whenever a new assed is added to AF, my customer would have to remember to update those 5 elements.

                       

                      I ended up using code to replace tag names on-the-fly, but it was not too bad I thought it would be. Since I am using the command "DoEvents", ProcessBook does not get stuck updating those tags anymore, and the customer will see the task progress (much better than looking at PB in "frozen mode").

                       

                      Regards,

                       

                      Fabiano

                        • Re: Reusing same VBA code on multiple ProcessBook displays
                          Asle Frantzen

                          Ok, I understand.

                           

                          One of the things we've been facing is exactly that shear amount of attributes (mainly PI Point data refs) needed to be set manually, since the customer has several naming conventions. I've been working a lot on this and figured out little things here and there, but I've created macro-enabled Excel workbooks where you input element names and select between naming conventions - and get suggestions you can check using the "Refresh" button in AF Builder. Then you'll hopefully get enough assistance that the work load of creating these AF elements/attributes comes down to a manageable level.

                           

                          Luckily, all meta data attributes are being looked up automatically just by splitting the name of the element. The naming convention there is always the "station" combined with the "equipment location", making up a unique identifier.