PmReport - Deatiled object description

See: Object PmReport
The object is used for creating reports from HTML, XML or TXT template files (these templates must be formated as described in Source file description of the PmReport object). The reports created by the PmReport object can be used, for example, for following purposes:
- for displaying in the PROMOTIC application window or in the Web client. For some specific purposes it is more useful to use PmReport than the PmPanel object. It is mainly connected with situations, when large amounts of data is to be displayed as tables, that are not being updated very often. The PmReport object window can be opened exactly the same way as PmPanel window, i.e. by the OpenView method (see also Object viewer open, see example Example2).
- for printer outputs, i.e. for example for creating multipage print reports. It can be easily done by the PmReport.SaveToString and Pm.PrintHtmlPage methods (see example Example2).
- to save it on the disk as HTML (XML,TXT) files using the SaveToFile method.
The PmReport object will, by means of expressions and keywords, process a text transformation over the source template (HTML, XML, TXT page) resulting in creation of output report. The transformation is processed by filling in the values, proporties and tag styles (using the keywords) with the possibility of unfolding or hiding a portion of the report template. The output report can be displayed, printed or returned in text variable.
Regarding updating the new values, there are two basic ways of using the PmReport object:
1st Updating the report while the final output report is being read:

For this purpose, the onReportRequest event can be used, initialized at the beginning of report content reading. In this event, it is possible to provide the changed values of keywords (via the SetKeyValue method), to read another source file, or re-read the current file (by changing the SourceFile property). If the keyword values and/or the template has been changed, then it is necessary to enter 1 into the pEvent.Modify output parameter, that will result in creation of new updated report. See Example1.

2nd Update the report independently on output report reading:

In this mode, the update is processed from the application by means of the scripting methods, independently, not related to report reading. The script can be used to provide modified keyword values (via the SetKeyValue method), read another template file, or re-read the current file (by changing the SourceFile property). If the keyword values and/or the template has been changed, then it is necessary to create the current updated report by using the MakeReport method. This allows to controll the report updates from another part of the application, for example from PmTimer (handy for example for regular print report updates). See Example2.

The example of report update with own reading (according to the no. 1). The script is located in the onReportRequest event. The color keyword value will be replaced by expression #ff0000 in the source file.
VBScriptSelect and copy to clipboard

pMe.SetKeyValue "color", "#ff0000"
pEvent.Modify = 1
The example of updating the report independently on reading (manual way no. 2). The script can be located anywhere outside the onReportRequest event. The color keyword value will be replaced by RGB color #ff0000.
VBScriptSelect and copy to clipboard

Dim oReport, oWorkspace, sReport
Set oReport = pMe.Pm("/Report")  'Path to the PmReport object
oReport.SetKeyValue "color", "#ff0000"

'Furthermore the content of the PmReport object will be displayed in the workspace window (in the PmWorkspace object):
Set oWorkspace = pMe.Pm("/Workspace")  'Path to the PmWorkspace object
oWorkspace.OpenView "/Report", "target:main;"

'Furthermore the content of the PmReport object will be sent to printer:
sReport = oReport.SaveToString("")
Pm.PrintHtmlPage sReport, "sourcetype:htmlstring;printer:select;"
In the object, there is a loaded, pre-processed report template, followed by the keyword set with values parametrizing the transformation (these are key and value pairs) supplemented by the last output report in the object's cache. By means of the keywords, it is possible to put a large amount of updated values into the report. It is possible to transfer the values of any data type (Variant), but also the complete one and two dimensional arrays. For using the keywords for transforming the template into the output report - see Source file description of the PmReport object.
For similar purpose as the PmReport object the PmWebDir object can be used. It is much more simple and less general. It is used only for offering static HTML pages with the possibility of simple keyword replacement.
Comparison of the PmReport object with the PmPanel object:
The Advantages of the PmReport object:
- easy creation of multiple page reports for printing.
- easy creation of reports containing large ammounts of datat.
- the texts are adopted to the width of the page (if HTML report).
Disadvantages of the PmReport object:
- when creating the report, basic HTML skills are necessary
- when creating the report, the statements described in Source file description of the PmReport object must be known.
- it is not suitable for displaying data with high refresh rate.
PROMOTIC 8.3.30 SCADA system documentation - MICROSYS, spol. s r.o.

Send page remarkContact responsible person
© MICROSYS, spol. s r. o.Tavičská 845/21 703 00 Ostrava-Vítkovice