Building a Device Status Report

Top  Previous  Next

The AggreGate Reporting facility is useful when you want to get some data in human-friendly printable form. Reports show device activity over time, and other statistical information.

This article shows how to create a report that includes the history of a certain device-generated event. We use a time recorder that is connected to AggreGate via Agent. Connecting the time recorder to the server is beyond the scope of this article, so we assume it is already online and visible for the system.

Our time recorder generates an event whenever an employee swipes their card. The event contains the cardholder ID, a direction mark (IN when the user enters the area or OUT when he exits) and a timestamp.

1. Creating a New Report

To create a new report, find the Reports node (st_reports) in the System Tree. Right-click it and select Create New Report (cm_create):

ht_report_1

note_tip-wt

You can also just double-click the Reports node to launch Create New Report action since it is a default action in Reports context.

In the Report Properties window:

Set Name to trevents
Set Description to Time Recorder Events

It's now time to set the most important parameter of the report -- the Source Data Expression. This expression tells AggreGate Server how and where to get the data for filling in the report template. At the report creation stage, it is also used to get data for auto-generating the report template.

We'll use the get function defined in the Events context for fetching event history for the report. This function returns the history of an event in the form of table, one record per event instance.

The function accepts four parameters (see its description for details), but we'll specify just the first two and leave the others at default values.

In our case, the first parameter is our time recorder's Device context path. We can detect this path by finding Time Recorder in the System Tree and checking its tooltip. Its path is users.admin.deviceservers.agent.devices.3_0:

ht_report_2

note_tip-wt

You can right-click the Device and select Copy from its context menu to copy its context path to the clipboard.

note_tip-wt

You can create a report that includes events from multiple Time Recorders. Just change the context path to a mask pointing to multiple devices. For example, to include events from all time recorders of the admin user, change Context Mask to users.admin.deviceservers.*.devices.*.

The second parameter is the name of the event generated by the time recorder. You can find it by browsing the Event Log. There is a special Event column that shows event names. In our case, the event is called event.

Our Data Source Expression will consist of a single reference to the get function, with two parameters.

Set Source Data Expression to {events:get("users.admin.deviceservers.agent.devices.3_0", "event")}

note_further-wt

Note that function parameters are enclosed into double quotes as these are simple text strings, not nested expressions. See Functions in References section for details.

Your Report Properties window should now look like this:

ht_report_3

Click OK to proceed. The Report Template Properties window will now open.

2. Configuring Report Template Properties

At this point it's necessary to set report template properties. The report template will be automatically generated according to these properties and data fetched using the Source Data Expression specified at the previous step.

Set Report Title to Time Recorder Events.
Change Orientation to Portrait as we'll have only three columns in our report and data will fit better that way.
Open the Visible Fields table and uncheck all fields except for the ones that you want to appear in the report. In our case, we'll leave Id, Direction and Date:

ht_report_4

Now click OK twice, to proceed. Report template will be generated by the server and you'll be prompted to edit it. Click Yes:

ht_report_5

The Report Editor will start, so you could edit the newly generated template.

3. Editing The Report Template

The Report Editor is a sophisticated component, but we are not going to perform any complex editing at this point. We only wish to change the report column titles.

First, change report scale from 100 to 200%. This will make further editing more comfortable:

ht_report_6

Now double-click the header of first column and change it to User ID. Change the header of the third column to Event Date/Time in the same manner.

Now select File > Quit to exit Report Editor. Confirm saving changes of report template.

New Report node (st_report) will be visible in System Tree:

ht_report_7

4. Viewing the Report

To fill the report with recent data and view it, right-click it and select Show Report from the context menu. Your report will open in a Report Viewer and you'll be able to browse, export and print it:

ht_report_8

note_tip-wt

You can also just double-click the report's node to launch the Show Report action since it is the default action for the Report context.