9 Replies Latest reply on Feb 25, 2009 5:16 PM by dhollebeek

    Detect New Alias/Tag in current module context

    rmarcell

      Is there any way, in VBA or otherwise, to detect and force the current module context to be reevaluated when an alias that previously didn't exist or have a valid tag for the currently selected module suddenly does?

       

      The only thing I can think of is to have a timer periodically force the context to be re-resolved which could potentially be expensive if you want the time lag between when this alias/tag creation event take place and it visually shows in the process book screen to not be too long (measure in seconds rather than minutes).

       

      Any suggestions are welcome.

       

      Thanks.

        • Re: Detect New Alias/Tag in current module context

          I would suggest you use PI SDK Event Pipes: declare a PISDK.EventPipe object and set it to the EventPipe property of the Server.PIModuleDB object. The Event Pipe for the Module Database would contain "add", "remove" and - the one you need - "edit" events on PI Modules.

           

          Then all you need to do is consume the Events contained in the event pipe, using its Take or TakeAll methods. These methods return a PIEventObject and a SAFEARRAY of pointers to PIEventObject objects, respectively.

           

          The PIEventObject then contains various properties such as EventData and PassivationString, which allow you to get more information on the object related to the event and even re-create it to access its aliases.

           

          Make sure you declare your EventPipe object "With Events" and at the module level. This way you can make use of its OnNewValue event and call the Take or TakeAll method within the event handler, as opposed to implementing a Timer.

           

          There's a couple of good articles and a nice example in the PI SDK Programming Reference (available on the vCampus Library or locally on a machine that has PI SDK installed: \PIPC\Help\PISDK.CHM). Hope this helps!

            • Re: Detect New Alias/Tag in current module context
              rmarcell

              Worked great, thanks. I now am able to detect that an alias has been added to the module which is the current context of the processbook display being viewed (my original goal) and want to get that context to "re-resolve" the pi points since the new alias may resolve which previously could not be resolved. That's the point I'm currently stuck on.

               

              I've tried calling ContextUpdated(ThisDisplay) which did nothing. So I set CurrentContext(ThisDisplay) to a different module and called ContextUpdated(ThisDisplay) and noticed that the selected module in the Available Modules tree changes but the tag resolution isn't reset - it's still displaying the tags from the old module.

               

              Is there another method I need to be calling? And should I be asking this question of tech support?

               

              Thanks.