TOPICA Basic Global Variables |
[This is preliminary documentation and is subject to change.]
Global variables are used to access information about the current context of the application. See also TOPICA Basic and Context.
Some global parameters will always have same value - e.g. DataDictionary.
Global variables EmployeeUser and PatientUser are defined by the logged in user, and will have the same value for the duration of the session.
Some global variables (e.g. Patient) will reflect the context selected by the user.
Some global variables will have same value during rendering of a page in the application. This is always true for Patient. It is also true for Record when rendering the page showing the record set in context. But during rendering of e.g. the patient record tree page, the record in context is varied (e.g. Record refers to each record being rendered in turn). This makes it possible to use TOPICA Basic to compute access to the record (i.e. to control security on the record level).
Name | Type (class) | Description | ||||
---|---|---|---|---|---|---|
db | Access to information on databse server and databse.
| |||||
DataDictionary | Metadata on the dynamic data model - i.e. data describing tables, fields, etc. | |||||
Table | When CREATING a new record (i.e. when a form is in "create mode"), Table refers to the DataDictionaryTable, that describes the database table, the new record will be created in. When VIEWING/EDITING a record (i.e. when a form is in "edit mode"), Table has the value null. To get the table the current record belongs to, use the expression Record.Table. | |||||
OrgUnit | The organizational unit in context. Set (e.g. not null) when an org.unit has been set in context. | |||||
Employee | The employee in context - happens during employee (user) administration. Set (e.g. not null) when an employee has been set in context.
| |||||
EmployeeUser Obsolete alias: User | The logged-in employee user. Set (e.g. not null) when an employee is logged in. If a patient is logged in, EmployeeUser will be null (and PatientUser will be different from null). | |||||
Patient | The patient in context. Set (e.g. not null) when a patient has been selected (set in context).
Not set (e.g. null) in all other situations. | |||||
PatientUser | The logged-in patient user. Set (e.g. not null) when a patient is logged in. If an employee is logged in, PatientUser will be null (and EmployeeUser will be different from null). | |||||
Record | The dynamic patient data record in context. The global variable Record is set (i.e. not null) in the following situations:
The global variable Record is null in the following situations:
| |||||
ParentRecord | The "parent" dynamic patient data record in context. The global variable ParentRecord is set (i.e. not null) in the following situations:
The global variable ParentRecord is null in the following situations:
| |||||
Form | The (dynamic) input form. This variable is set (holds value different from null) only when the user has a dynamic form displayed in the user interface. Use the Form global variable to access the values entered by the user in the input fields of a form. This is used only in validation rules.
There is no way to set the Form global variable in the "TOPICA Basic Test" tool TestEvaluation.aspx, so you cannot test TOPICA Basic expressions involving Form in the "TOPICA Basic Test" tool.
Example: The current form as an integer field X. We want to implement a validation rule, that chekcs that this value is set to 1 at creation time, and (optionally) incremented by 1 at every update. If(IsNull(Record), Form.X=1, (Record.X<=Form.X) And (Form.X<=Record.X+1)) |
![]() |
---|
It is important NOT to dereference null objects. As in most programming languages, dereferencing a null object causes an exception. Examples:
|
![]() |
---|
This topic describes only the built-in TOPICA-specific global constants. As described elsewhere, TOPICA Basic is an extension of the generic expression language defined in the "rule engine" (documented separately). Therefore, all constants defined in the "rule engine" also exist in TOPICA Basic. All parameters defined in the config files are accessible from TOPICA Basic as string values - simply by specifying the parameter key. This mechanism is obsolete - partly because of risk of "name clashes", partly because this does not work when the key contains ".". The preferred way to access .config-file parameters values is using the ConfigString function). |