Automatic Report Generation

After designing the report layout in Report Designer and saving it to the Report Item, the report can now be generated at Run Time, retrieving up-to-date values from the Query Objects a populating the report with Realtime and History values.

To do this, the Lua script in the Report Item needs to be executed every time the report needs to be generated. This can be done manually or by creating a triggering reference to another item that will execute the report generation periodically. This triggering reference could be to another data producing item that triggers the report generation every time its value changes. For the purpose of this example we will create a Generic Item that will trigger the Report Item periodically.

Adjusting the Example Report

Some changes to the configuration of the example report are helpful to quickly see the Reporting System at work.

Adjusting the Time Period Settings in the Query Options

1 In the I/O Model, select the Report Item.

2 In the Properties Panel, expand the HistoryQueryOptions for Hist-EX-DD-PD and set the Timesettings property (see image on the right) to [*-1m] - [\*] / 6 to fetch six values for the most recent minute - as illustrated below.

For more information on the Time Period Settings dialog see this section of the History Grid documentation.

3 Apply the changes to the Property Panel.

Adjusting the X Axis Labeling for the Chart

1 Open the Report Item in the Report Designer, and double-click on the chart to open the Chart Editor.

2 In the Chart Editor, go to the Area Tab and select the X Axis properties option.

3 In the Chart Editor’s Properties Panel, in the Main section, expand the Labels sub-section.

4 Set the Format property to hh:mm:ss.

Trigger Setup

Next, we will create a Generic Item which triggers the Report Item periodically.

1 Right-click on the Report Demo folder and select Admin  New  Data Processing  Generic Item from the context menu. In the Create Object Wizard, fill in the Object Name as "Trigger". Set the generation period to 10,000 ms and then click Create.

2 Select the "Trigger" Object and drag and drop onto the Test Report Item to bring up the Set Object Reference dialog. Click Ok to set the reference.

Automatic Report Generation At Work

The triggering reference now executes the script every 10 seconds to retrieve data from the Query Objects.

To view the report, right-click the Report Item and select Add item to…  Dashboard (shortcut Alt+D).

The values for the Query Objects should be updated every 10 seconds as the report is triggered and a new report is generated.

If the Report does not appear in the Dashboard, you may need to change to "Report View" in the Dashboard menu bar. If the report is still not visible, try refreshing the dashboard tile by right clicking, selecting Report Template and clicking on the Report Design Data template name.

The Report is added to a single tile on the dashboard. To see it more clearly you may need reduce the number of rows and columns in the Dashboard. In the screenshot, the Dashboard consists of one row and one column.

Editing Triggered Reports

Before editing a report which is periodically triggered, disable the trigger, e.g. by removing the reference or disabling the triggering object. Otherwise any edits may be lost.
Before re-enabling the trigger, save the changes in the Report Designer.