Session Variables
ExtraView supports a concept known as session variables. These are defined in the data dictionary and supported by code internal to ExtraView, or by user custom code. For example, there is an in-built session variable named USER, which is used to provide the user’s session with the name of the current user. This has a title of * Current User Name *.
You will see this being used in several places in ExtraView, most notably within user field display type lists on search layouts. This allows the user to define a report filter, which when run, will always point to the current user. Session variables can be defined in the following way:
- Create a new field in the data dictionary, under the tab named Session Variables. For example, create a field named MY_VAL
- Provide a title to this new variable, for example * My Value *
- Use a display type of CUSTOM to complete the entry, then save the new field.
Now we want to use this field, we need to support it with code that provides a runtime value. For example, we may want to place this new runtime variable onto a list. Within the method ucRenderListValues you can add the following code:
if (ddName.equals("OWNER_GROUP")){
// Get the DDE for the variable to add to list
dde = Z.dictionary.getDDEntry(dbConn,"USR_GRP");
selList.put("$$USR_GRP$$",dde.getTitle(loc));
return;
}
You must also make sure your variable is placed into the Session object at runtime with your user custom code.