...
Code Block | ||||
---|---|---|---|---|
| ||||
<?xml version="1.0" encoding="UTF-8"?> <reports version="1.0" xmlns="http://www.wldelft.nl/fews" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.wldelft.nl/fews http://fews.wldelft.nl/schemas/version1.0/reports.xsd"> <declarations> <templateDir>d:\FEWS\FEWS_SA\report\<<templateDir>$REPORT_TEMPLATE_DIR$</templateDir> <reportsRootDir>d:\FEWS\FEWS_SA_sa\report\<<reportsRootDir>$REPORT_ROOT_DIR$</reportsRootDir> <sendToLocalFileSystem>true</sendToLocalFileSystem> </declarations> <report> <template>template.htm</template> <outputFileName>report.html</outputFileName> </report> </reports> |
The templatedir and the reportrootsdir can directly aim at a directory, but it is also possible to use global variables (as in the example).
Later we will expand this module instance.
...
To be able to run the workflow manually, it needs to be registered as a task. Therefor Therefore in the file "Taskrundialog.xml" in the folder "DisplayConfigFiles" the following information is added:
...
Info | ||
---|---|---|
| ||
Notice that the WorkflowId is the same as the name of the file which contains the workflow! In this case it is "report", which is the same as the file "\WorkflowFiles\report.xml"! |
Setting up a report with a chart
The report configuration file contains two main parts: The "declarations" and the "reports".
The "declarations" section describes how the report items (like graphs, texts and tables) should look like. Therefore it is actually a template for the report items in this report module.
In the "reports" section the data items are configured that are to be displayed in the report. This forms this way a coupling between timeseries/data and the templates. For example: we have ten time series with water levels. We want them to be displayed in a chart. Of course the layout of the charts should be the same. The layout of the chart is described in the "declarations" section. The connection between the template chart and the timeseries is configured in the "reports sections".
Declaration
In the next code block is a configuration of a simple chart:
Code Block | ||||
---|---|---|---|---|
| ||||
<chartFormat id="ChartFormat1">
<includeTime0>true</includeTime0>
<includeLegend>false</includeLegend>
<bottomAxis>
<format>dd/MM HH:mm</format>
<centerLabelsBetweenTicks>false</centerLabelsBetweenTicks>
</bottomAxis>
</chartFormat>
<templateDir>$REPORT_TEMPLATE_DIR$</templateDir>
<reportsRootDir>$REPORT_ROOT_DIR$</reportsRootDir>
<sendToLocalFileSystem>true</sendToLocalFileSystem>
|
The first part is the chart format. Very important is the Chartformat ID. This ID is later used to connect the timeseries to this chart layout.
The second part contains some global settings, that are valid for all the reports in this configuration file. These are (in this example) the templatedir, the report root dir and a boolean value which tells FEWS to save the report files as local files. If set to false, the results will be stored in a database.
Report
In the next block of code we connect the chart layout to a time serie.
Code Block | ||||
---|---|---|---|---|
| ||||
<report>
<inputVariable variableId="OB_H1" variableType="any">
<timeSeriesSet>
<moduleInstanceId>ImportAquaView</moduleInstanceId>
<valueType>scalar</valueType>
<parameterId>H.meting</parameterId>
<locationSetId>OB_H.meting</locationSetId>
<timeSeriesType>external historical</timeSeriesType>
<timeStep unit="minute" multiplier="5"/>
<relativeViewPeriod unit="hour" start="-10" end="10"/>
<readWriteMode>read only</readWriteMode>
</timeSeriesSet>
</inputVariable>
<chart id="chartMainH" formatId="ChartFormat1" width="600" height="300">
<leftAxisScaleUnit>0.2</leftAxisScaleUnit>
<timeSeries>OB_H1</timeSeries>
</chart>
<template>template.html</template>
<outputFileName>chartreport.html</outputFileName>
</report>
|
In the report there are three sections:
- Input variables
- Report elements (in this example the chart)
- Other properties
In the input variables the timeseries are defined that are to be shown in the chart (it is also possible to declare them in the declarations section of the report!). The relative view period defines what part of the time serie is to be shown in the chart. The variable ID is used later when assigning the time serie to a chart!
In the chart section the connection is made between the time serie(s) and the chart layout (as defined in the declarations section).
Info |
---|
The formatID should be the same as the ID of the chartFormat as defined in the declarations section! |
The HTML file "template.html" will be used to create the report. The outputfile will be "chartreport.html"
HTML template
The chart will be placed in a HTML file. The HTML file is based on a template file (name and location of the template file was configured in above sections). The template file is a simple HTML file which can be layouted by the user. For the report module to know where to place the chart, a Tag needs to be placed in the HTML file. The TAG for a chart is: $CHART(ID_of_the_chart)$.
An example of an HTML template is given below:
Code Block | ||||
---|---|---|---|---|
| ||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1252"> <TITLE>Management Report: System Status Report</TITLE> <!--check for right levels up--> <link href="css\styles.css" rel="styleSheet" type="text/css"> <link href="css\tables.css" rel="styleSheet" type="text/css"> </head> <body> $CHART(chartMainH)$ </BODY> </HTML> |