Context variable

The WorkWithPlus Pattern Settings editor, General settings tab, shows a tree with Settings > Context > WWPContext, the WWPContext node selected, matching the context-variable configuration under General settings.

Context variable node has the following properties:

Category Property  
General Properties Name

The Properties panel for the ContextVariable WWPContext shows Name "WWPContext", Type "WWPContext", and Load Procedure "LoadWWPContext".

Type
Load Procedure

General Properties:

Name:

Context variable's name.


Type:

Variable's type. Context variable could be defined based on a domain, an attribute or an SDT.


Load procedure:

Procedure that will be invoked in order to load this variable from context (session).


The purpose of this node is to centralize in a variable all the information that needs to be used and consulted through many parts of the application. For example, save information about the application user, its role and its company in order to limit the actions he could do. 

This variable will be loaded on Start Event of every object generated by the pattern, so that user can consult some information about the application or set information to it that will be relevant onwards (by saving the variable in session).

WorkWithPlus Configuration has by default a context variable named 'Context', which is defined based on an SDT named WWPContext and it is loaded by LoadWWPContext procedure. This SDT can be modified by user and will not be overwritten when re applying the pattern. In fact, the idea of having the context based on an SDT is to allow user to add new attributes to it when needed in order to have all the information about the application centralized.

The default context variable is defined base on WWPContext SDT:

The Structure editor for the WWPContext data type lists its attributes UserId (Numeric 4.0, description "User Id") and UserName (VarChar 100, description "User Name").

As we mentioned above, the context will be loaded on stard event of every object generated:

The Person transaction's Start event code shows LoadWPContext.Call(&WWPContext), with a callout "Load the context variable from session", followed by generated code that inserts CompanyId from &TrnContext attributes and hides PersonTeamFan, PersonHairLength, and PersonHairStyle in the web form.