Elastic Report Plugin
Overview
Elastic Report Plugin allows to generate reports according to a custom configuration. Using this plugin, you can build almost any desired report. A user simply selects the period and clicks the generate report button. Report configurations are created by an administrator. Download the plugin using the link.
Installation
Elastic Report Plugin is installed according to the instructions. During installation, complete the following additional step: copy the PlgElasticReport.xml
file from the plugin distribution into your project. The file should be displayed in the project explorer under the Webstation > Configuration Files node.
Configuring
A report consists of a set of sections, which are listed in the output document, one by one. Each section has its own type, parameters, and data binding. In addition, the report has the general parameters that affect all sections. The same report can be generated in a variety of formats. Currently supported PDF, Excel and HTML formats. The appearance of the same report, generated in different formats may slightly differ.
Report Form
Each report form requires the creation of a separate configuration file in XML format. The configuration file specifies the report formatting and determines the binding of report data to channels. This file should be saved in the views directory or a subdirectory within the project.
Configuration files may be edited using any text editor. For example, the free editor Notepad++ is convenient for working with XML files.
An example report file ElasticReport1.xml
is contained in the plugin installation package. This example includes a detailed description of the options and demonstrates the generation of report sections of all possible types.
The main elements of the report configuration file:
- The
InputOptions
element contains options for the input report form, with which a user enters the report parameters and starts generating the document. - The
OutputOptions
element contains formatting options for the generated document. -
The
Document
element defines the content of the report.- The
DocumentOptions
element specifies basic options that apply to the entire document. - The
Section
element describes a report section containing data. A report includes one or more sections of various types.
- The
The supported section types:
- The
TimeData
section displays channel data for the selected time period. Channels are displayed horizontally, timestamps are displayed vertically. - The
TimeTime
section displays data of one channel in a compact form. Timestamps are displayed in the horizontal and vertical section headers. - The
DataData
section displays data in a table form. Each cell can be linked to its own channel.
The plugin provides the generation of reports based on historical data. Reports on current data and events are not supported. When choosing a historical archive for a report, it is recommended to give preference to an archive with a data writing period that matches or is close to the step of the report sections. This will avoid fetching unnecessary data.
Report List
The PlgElasticReport.xml
configuration file contains a list of reports divided into groups, which are displayed on the Main Menu > Reports page. Example of file contents:
<?xml version="1.0" encoding="utf-8" ?>
<PlgElasticReport>
<ReportGroup name="Elastic Reports" isPublic="false" objNum="0">
<ReportItem reportID="1" isPublic="false" objNum="0" config="Reports\ElasticReport1.xml" prefix="MyRep" cnlNums="">My report</ReportItem>
</ReportGroup>
</PlgElasticReport>
The ReportGroup
element attributes:
name
- the display name of the report group;
isPublic
- a value indicating whether the group is public, that is, available to all users;
objNum
- the number of the object to which reports of the group belong. Restricts the group visibility according to a user's access rights to the object.
The ReportItem
element attributes:
reportID
- the report identifier, unique within the configuration file;
isPublic
- a value indicating whether the report is public, that is, available to all users;
objNum
- the number of the object to the report belong. Restricts the report visibility according to a user's access rights to the object;
config
- the path of the report form configuration file relative to the views directory,
prefix
- the file name prefix used when downloading the report,
cnlNums
- the predefined channel numbers for which the report is generated.
Styling
You can customize your own report styles, including fonts, colors, cell sizes, etc. For each report format, styles are configured separately.
PDF Styles
The PdfStyleDefault.xml
and PdfStyleCustom.xml
files specify the formatting of reports in PDF format. These files are located in the web application directory ScadaWeb\wwwroot\plugins\ElasticReport\templates
. The PdfStyleDefault.xml
file contains the default styles and should remain unchanged. Custom styles are added to the PdfStyleCustom.xml
file. When creating custom styles, you can inherit new styles from existing ones or override existing styles.
Excel Styles
Similarly, the ExcelStyleDefault.xml
and ExcelStyleCustom.xml
files, located in the same directory, specify the formatting of reports in Excel format. The ExcelStyleDefault.xml
file contains default styles and should remain unchanged. Custom styles are added to the ExcelStyleCustom.xml
file. Please note that PDF and Excel style file formats are different.
HTML Styles
The html-style-default.scss
and html-style-custom.css
files define the display of reports in HTML format. The files are located in the ScadaWeb\wwwroot\plugins\ElasticReport\css
directory. Custom styles are added to the html-style-custom.css
file using Cascading Style Sheets (CSS) rules.
Fonts
Fonts in PDF Format
When generating reports in PDF format, the Arial font is used by default. If the required font is not available in the operating system, it is replaced with the built-in Segoe WP font. To change the report font, edit the styles file.
The font search is performed using the following algorithm:
- The search directory is selected. On Windows, the search is performed in the
C:\Windows\Fonts
directory, on Linux in the/usr/share/fonts/truetype directory
-
Based on the font name (FontFamily), the required font file names are determined.
- Regular font:
FontFamily.ttf
,FontFamily-Regular.ttf
- Bold font:
FontFamilyb.ttf
,FontFamilybd.ttf
,FontFamily-Bold.ttf
- Italic font:
FontFamilyi.ttf
,FontFamily-Italic.ttf
,FontFamily-Oblique.ttf
- Bold italic font:
FontFamilybi.ttf
,FontFamily-BoldItalic.ttf
,FontFamily-BoldOblique.ttf
- Regular font:
- Fallback font file names (candidates) are determined. For bold or italic fonts, regular font files are used as candidates. There are no fallback options for a regular font.
- If a desired or fallback font is found in the search directory, the font file is loaded and provided for report generation. The search is not case sensitive.
The default fonts usually do not contain characters for languages such as Chinese and Korean. To generate reports in such languages, it is recommended to install the Arial Unicode MS font. On Windows, the font installation is required for all users so that the font file is placed in the C:\Windows\Fonts
directory.
Fonts in Excel Format
In generated reports in Excel format, only the font name is specified; the font itself is not included in the report file. The default font is Arial. When a file is opened in Microsoft Excel or Libre Office Calc, the application loads the font from the system. If the font is missing, automatic replacement is used. You can change the font using the styles file.
Generating Report
The list of reports is displayed on the Main Menu > Reports page according to the PlgElasticReport.xml
configuration file. By clicking on a report item, a user navigates to the report parameters page. The set of fields in that form depends on the report settings. After entering the report parameters, click the Download Report button to start generating and downloading the report.
Report generation can be started using a direct link. In this case, a user must be logged in. Link examples are shown below. Please note that the sets of request parameters for PrintReport1
and PrintReport2
addresses are different.
Example 1:http://localhost:10008/ElasticReport/Print/PrintReport1?reportID=1&startTime=2024-05-28&endTime=2024-05-29&archive=Hour&format=Html
Example 2:http://localhost:10008/ElasticReport/Print/PrintReport2?reportID=1&period=1&unit=Day&archive=Hour&format=Html
Parameter | Data Type | Description |
---|---|---|
reportID | Integer | Report ID from the PlgElasticReport.xml file |
startTime | Date and time in YYYY-MM-DD or YYYY-MM-DD'T'HH:MM format | Report start date and time |
endTime | Date and time | Report end date and time |
period | Integer | Reporting period relative to the current date |
unit | Day | Month | Reporting period unit |
archive | String | Archive code from which the report data is taken |
format | Pdf | Xlsx | Html | Output format |