5 Replies Latest reply on Jan 25, 2018 4:38 PM by kduffy

    Would like to show notes on a PI tag selected in processbook

    RyanVal

      Our displays have lots of tags on them so having text boxes gets too messy, or having the text boxes at the bottom gets too lengthy. Having a button by each tag would be very tedious and the notes are too long to be put in as the PI tag description.

       

      Similarly to how right click >"Show details and annotations" > "statistics" changes and shows info for each tag slected, I'd like to show notes associated with a PI tag. Perhaps coming from an excel sheet like here:

      Processbook: Make a lookup in Excel

       

      Is it possible to have the notes show up on the display, a dock-able window or a floating window depending which PI tag is selected? How? Any help is appreciated

        • Re: Would like to show notes on a PI tag selected in processbook
          kduffy

          Hi Ryan,

           

          I'm not sure that there's an easy way to do this.

           

          The functionality you're describing is basically what the details and annotations pane is in terms of usability, but the exact data it's accessing is not what you want. Since you can't extend the details and annotations page to include this, then a new custom addin or VBA project will need to be written.

           

          If you wanted to go that route, one thing I think should work is to create a window in VBA and dock it using something like pbDockPosition, then you can use the Excel ODBC driver in conjunction with ODBC datasets that utilize placeholders. You can have a Display_SelectionChange event that'll trigger any time a new item is selected, and the code in that event handler can detect if you just clicked on a value symbol. If you did, it could set the odbc dataset placeholder to match name of the tag in the value symbol, then the result of that query can be displayed in the docked window.

           

          Alternatively, if you have AF then you could add your notes as attributes or child attributes, and put those into ProcessBook either directly or through element relative, etc. Either way, it would greatly simplify the approach and those notes would be exposed to any PI client or library if the AF server were the one querying teh Excel sheet, instead of it being locked into ProcessBook.

           

          What are your thoughts on these approaches?

           

          Kelsey

            • Re: Would like to show notes on a PI tag selected in processbook
              RyanVal

              Thank you for the reply! My site hasn't rolled out AF yet (and probably won't for a while) so I'll have to go the other route. Does the VBA code have to be written in each processbook graphic I'd want to use it in? I've done some work in VBA (excel) before but I'm not too familiar with pbDockPosition, ODBC datasets or Display_SelectionChange. I'll try searching and educating myself. If there's any good examples on these subjects please let me know.

                • Re: Would like to show notes on a PI tag selected in processbook
                  kduffy

                  If you wanted to go the VBA route, then you could save the bulk of the code as a module, and import it into each display. Then you'd need to recreate only the event handlers that call the functions in the module when you make subsequent displays (such as Display_open() to call a function in the module such as ShowNotesPane(); and then a Display_SelectionChange() handler that calls a function in the module such as UpdateSelection()).

                   

                  If you wanted to have everything work out of the box for all new displays created, then you would want to go down the custom add-in route. This can very easily become a substantial amount of development work, though, so I wouldn't necessarily recommend it. But if you are interested in that route, you can follow these templates, and you'll need to make a few other changes from there with the registration process that we can assist with if it gets that far. In this route, though, you'd be using Visual Studio and either C# or VB.NET instead of VBA within ProcessBook.

                   

                  As for examples, everything we have in documentation form will be in the programmers guides (2015 is the latest one, it's a chm format; 2009 is the latest one in pdf format). Within the pdf version, chapter 6 (starting on page 71) provides information about dockable windows in general and has numerous example code chunks throughout the chapter. I don't think we have an entirely start to finish example anywhere, maybe there's some on pisquare somewhere, but the guide walks you through the whole process, more or less, over the course of a few dozen pages.

                   

                  But like I said earlier, this effort, especially for someone who isn't already familiar with VBA, is probably going to be a large undertaking, so I would keep that in mind.

                   

                  Kelsey