There are two ways of creating reports in server-side scripts:
- Using the Report Wizard
- Manual report creation
Report Wizard
This feature helps you create a report step-by-step in the scripts, which saves you plenty of time spent creating the reports manually.
1. Select the Server-Side Scripts folder in the Project Window and click on the Report Wizard icon in the toolbar. The following window will appear:
2. In the tab Data-log, select data-logs and tags to be included in the report table. You can also activate data processing in the script – check the box Process Data in Script. If you wish to create a report without data-logs check the box Without Data-log, then click on the Next
3. The following Chart tab allows you to include a time chart of data-logs in the report. You can select the data-logs and tags to be displayed. If you do not wish to include the charts in the report, check the box Without Chart. Click on the Next
4. In the Alarms tab, you can select alarms to be included in the report; then click on the Next
5. In the Send tab, you can select the way the report from your project will be sent. Fill in the necessary information as shown in the picture below and click on Next.
6. In the last tab, you will see the list of generated report template files. Now, you have to set the triggering actions for your report to be sent. Click on the button Copy Code to Clipboard to use a generated report script for later use and click on Close.
Manual report creating
Report templates are created in MS Word (and other compatible text editors) with simple syntax. During report processing, all defined variables inside a Word document are replaced with the script data.
Example:
1. Prepare a report in MS Word (or any compatible text editor)
a) To replace a single variable, put it inside single brackets: {variable}
b) To create a loop, you can use loop opening {#} and loop closing {/} brackets.
c) Import the document into UserFiles in the Server-side Scripts folder:
2. Create a script to fill in the MS Word report with data:
- Note: You can use the timed scripts for report generation in predefined intervals or for certain dates.