3 Replies Latest reply on Mar 12, 2009 8:05 AM by MikeReid

    Using IContextDataResolver?


      Hi All,


      Has anyone figured out how to use IContextDataResolver in ProcessBook?


      TechSupport recommended just using the SDK instead - but it looks like it should be able to do what I want...


      (i.e. I want to be able to get the tag name for an alias in the currently selected MDB context.)



        • Re: Using IContextDataResolver?

          Interesting question ...


          The most common (and most intended) use of IContextDataResolver is too allow programmers to create their own context resolvers and register them with PB (like the MRD add-in does).  But that's not what you want out of it ... if you could get ahold of MRD's context handler (or create one of your own), this could be done, but a quick look at the MRD interface doesn't look too promissing.  I'll play around with this and see if I can come up with some code that will work for this.

          • Re: Using IContextDataResolver?

            @Mike Reid: as David pointed out, the IContextDataResolver interface is one you need to implement if you develop your own ProcessBook add-in and want it to be "Module Database aware"- it is passed from an add-in to ProcessBook; PB does not expose this interface. It is the responsibility of the add-in to implement this interface, typically using the function Application.ContextHandlers.Add(Name as String, Module as String, ContextDataResolver as Unknown) to supply PB with the interface.


            TechSupport was right in that you should use PI SDK to resolve the tag name for an alias... more specifically, a combination of the PI SDK and the ProcessBook object library.


            First you can obtain the "current context" of the display using this:



            And then get in the Module Database via the PI SDK (Server.ModuleDB), make a reference to the current context (using a PIModule object) and resolve the tag name for a given alias (via the PIAliases collection). Should you require any further assistance on doing this, please do not hesitate to post on the PI SDK Development discussion forum.


            Hope this helps!

              • Re: Using IContextDataResolver?

                Thanks for the clarification guys.




                I found the reference in ProcessBook Help, and thought I'd found a shortcut to what I wanted to do...


                I'm going back to the site where I started this next week, so I'll write some SDK code to do what I need then.