25.10.Creating report on demand
You can also create reports using server side scripts. This way, you can make periodic reports, or reports triggered by some event, options are limitless. To get started:
1. Create Report Template as described in previous chapter
2. Edit server side script – if you don’t use your own module, simply edit main.js
3. Once you open the script, click on the Report icon
4. You will get the Report generation dialog. Select a report you want to generate, fill in the required values and press OK button.
Create report dialog has several sections:
Limit by time: first you can limit the report generation by time. Time is specified in UTC format in seconds since 1.1.1970. You can enter a value or provide a variable where the value is stored.
Filter: if the data-log contains a keyed value, you can limit results shown in your project by specifying a filter value. Again this can be a hard value or variable.
Limits: please provide limits for the number of records loaded. Each data-log or alarm values used in reports are provided in the Limits table. Please fill in the limit of rows to load. You can also specify if the limit is taken from the beginning eg. “from start” or from end.
Save as: provide a file name under which report will be saved to. You have an option to save a report in PDF format, in HTML format or pass it as JSON data object. Report is saved into user data folder accessible over FTP or HTTP and HTTPS.
Language: If your project is Multilanguage, please specify in what language report should be generated.
5. myDESIGNER will generate code template for you. When you run the code, the system will generate a report for you and save it into the user directory.