Click or drag to resize
* Report Context

[This is preliminary documentation and is subject to change.]

Reports in TOPICA always run in some context The current user (represented by the TOPICA Basic global variable EmployeeUser - in older version named User) is always defined, i.e. not null (except for a few special reports, that may run without a user being logged in).

The placement of the report definition in the Configuration Folder Structure determines in what context the report may be run.

In other words: When developing a report, the first question you ask yourself is: In which context should this report run? The answer to this question determines in which folder you should place the report definition file.

This topic contains the following sections.

System context (= no context object)

Reports placed in folder <configuration folder>/Views/System are called system reports.

System reports do not have any objects in context besides the current user.

System reports are intended to access data across the entire database.

System reports are started from the menu item "System / Reports".

In "system context", all the TOPICA Basic global variables OrgUnit, Employee, Patient, Record all have the value null.

Security note Security Note

Per default, reports in folders, including <configuration folder>/Views/System are accessible by everyone.

Because system reports are intended to access data across the entire database, many system reports should NOT be accessible by all users.

For reports that display information, that only users with special permissions should be able to see, it is the responsible of the configurator to set up the security.

Context: organizational unit

Reports that are designed to run with an organizational unit in context may be placed in one of these folder:

  • Reports placed in folder <configuration folder>/Views/OrgUnit are always started with an organizational unit in context. That is: the TOPICA Basic global variable OrgUnit is guaranteed NOT to be null.

    The ONLY way to start reports in this folder is to set the requested organizational unit in context in the application, and selecting "Reports" from the sub-menu. The security requirements for accessing reports in this folder are:

    • The user must be employed by or associated with the organizational unit in question, or one of its ancestors.

  • Reports placed in folder <configuration folder>/Views/System/Tables/<table name> (where <table name> corresponds to tablenames as defined in the Data Dictionary), may be run with or without an organizational unit in context. That is: the TOPICA Basic global variable OrgUnit may or may not be null.

    These kinds of reports only make sense when the TOPICA application has a working Data Dictionary. This will be the for applications that handle configured patient data. Applications that do NOT handle configured patient data do NOT use this kind of reports.

    Whether there is an organizational unit in context or not, depends on how the report was started:

    • The user sets an organizational unit in context in the application, and selects "Reports" from the sub-menu. In this way the selected organizational unit is defined when the report runs, i.e. the TOPICA Basic global variable OrgUnit is NOT null.

    • Ths user selects the menu item "System / Reports". In this way the selected organizational unit is NOT defined when the report runs, i.e. the TOPICA Basic global variable OrgUnit IS null.

    Note that <configuration folder>/Views/System/Tables/<table name> is a sub-folder of <configuration folder>/Views/System. This has the consequence, that any report that may be started with an organizational unit in context, ALSO may be started as a system report WITHOUT any organizational unit in context.

    The idea is, that whenever you design a report that runs on data for a selected organizational unit, it may be useful to be able to run the SAME report on data from the entire database.

    To you as a configurator this means, that when designing a report to be placed in <configuration folder>/Views/System/Tables/<table name>, you must design the report with this in mind:

    • When the report is started WITH an organizational unit in context, you must filter by that organizational unit.

    • When the report is started WITHOUT an organizational unit in context, you should NOT filter by any organizational unit. Or - if you do not wish to enable the report to access data from the entire dababase: Show a warning and omit the data (you may use the Coditional attribute to implement this).

    See the fully working example in TOPICA Report Format for detailed instructions on how to properly handle both situations (with and without organizational unit in context).

The two types of reports that may handle context = organizational unit are displayed together in the user interface, when the user sets the requested organizational unit in context in the application and selects "Reports" from the sub-menu.

When developing reports you have a choice, whether your report should be placed in one or the other of the above mentioned folders. As a general rule, when developing a report that reads data from table <table name>, you should place that report in folder <configuration folder>/Views/System/Tables/<table name>. The reason for this is:

  • Each organizational unit has relations to a set of tables = the tables it may be "data owner" for.

  • When displaying the hierarchy (tree) of available reports, TOPICA does NOT display reports defined on tables, for which the actual organizational unit is not "data owner".

  • This prevents the user from starting reports, that does not make sense for the actual organizational unit.

Context: employee/user

Reports placed in folder <configuration folder>/Views/Employee run with an employee (user) in context.

These reports are started by setting the requested employee in context in the application, and selecting "Reports" from the sub-menu. This requires the user has minimum read access to the employee. This in turn means, that the user have read access to the organisational unnit, where the employee is employed or associated, and read accees to employees/users.

When an employee is in context, the TOPICA Basic global variable Employee is set (NOT null). Note that this value is NOT necessarily the same as the "current user" (User), because the current logged in user may run reports with other employees / users in context.

Context: patient

Reports placed in folder <configuration folder>/Views/Patient run with a patient in context.

These reports are run by setting the requested patient in context in the application, and selecting "Reports" from the sub-menu. This requires that the user has minimum read access to patient or patient data.

When a patient is in context, the TOPICA Basic global variable Patient is set (guaranteed NOT to be null).

If the TOPICA Basic global variable Record is set (not null), then there is a record in context - see below.

Context: record

Reports placed in folder <configuration folder>/Views/Record/<table name> run with a record (i.e. a form instance) in context.

How to run a report with a record in context:

  • Select a patient (sets the selected patient in context). This requires that the user has read access to the patient.

  • Open a record e.g. by clicking an "open" node in the record tree (sets the selected record in context). This requires that the user has read access to the record.

  • The form is displayed with data from the seelcted record. In the top right hand corner of the form, a print icon is displayed. Click this icon.

  • A new browser window pops up. The contents of this browser window depends on the number of reports defined in the folder <configuration folder>/Views/Record/<table name> (where <table name> is the name of the table of the selected record).

    Count

    Action

    0

    I.e. NO reports are configured for this table.

    An auto-generated default form print view (with data from the selected record) is displayed.

    Click the "Print" button or use the browser's print-function to print this "print view".

    1

    The unique report found is automatically run. Any supported reports formats is possible.

    In case of the "simple" TOPICA built-in report format or a Reporting Services report, the report definition should have attribute AutoSubmit=True (see ReportDefinition). This results in, that the report is displayed automatically - otherwise the end user must click the "OK" button before the report displays any data.

    > 1

    I.e. SEVERAL reports are configured for this table.

    The TOPICA framework does not know which of these reports the end user would like to run.

    Therefore, a list of the available reports is displayed. When the end user clicks one of the reports, it is run (just as if the selected report was the only one - see above).

When a record is in context, the TOPICA Basic global variable Record is set (guarenteed NOT to be null).

Note that whenever a record is in context, there will also a patient in context (all records relate to a patient). That is, the TOPICA Basic global variable Patient is set (guaranteed NOT to be null).

Subfolders and security

In all of the above mentioned folders, the configurator may define any number and levels of subfolders. These are displayed hierarchically (in a tree) in the user interface.

Security note Security Note

Per default, all reports are accessible. If the user has access to display a report folder (with a given context), (s)he may per default run all reports in the folder.

For reports that display information, that only users with special permissions should be able to see, it is the responsible of the configurator to set up the security.

This is basically done by arranging reports in subfolders, and specifying a TOPICA Basic expression per folder that grants/denies access to the folder.