PIContext Object




The PIContext object represents a shared string on the server that may be associated with a PIUser and used in applications to identify a set of users with a common trait.

Each PIUser is given a default PIContext when created which is stored on the server. This default may be changed programmatically to any PIContext in the PIContexts collection. In addition, at run time, a PIUser object contains both a DefaultContext property and a CurrentContext property. The CurrentContext is filled with the DefaultContext when the PIUser is first retrieved from the server. The CurrentContext is not persisted to the server and is available primarily for storing a temporary context for a user during an application run.

PIContext objects are provided as a means for a program to associate a user with some logical application entity and then provide appropriate customized behavior for user's with certain PIContext strings. For example, one might choose contexts that represent certain employee roles. The application could make different features available depending on the user's role. The default context would store the role most often used by the user and the current context could be used when the user needs to switch roles within the application. As another example, contexts might represent different Units in a plant. An application could use a context to translate a generic alias (e.g. Preheater_Temp) into a specific tag name for the unit. The user's default context would be the Unit the user most often is interested in but the current context would change as the user works with different plant Units.  

This object supports the IRefresh interface.

Enabling Operational Intelligence