Text Report Tag

Help Contents

Introduction

The Text Report Tag Report Tag Icon is a template used to create text based reports. The report template consists of:

The Text Report can run:

The report output can be optionally:

Configuration Properties

The Text Report Tag supports the properties of the Core Tag plus these properties:

Property Type Version Description
RunInterval TIME 3.23 How often the report is run automatically. A value of zero (T#0s) disables automatic running of reports. See Interval and Offset for information on how Intervals and Offsets define the time of activities.
RunOffset WSTRING 3.23 The offset added to the RunInterval to get the actual time the report is run.
EmailAddress WSTRING 3.23 The email address to send the report to. If this property is blank, the report will not be sent using email.
EmailSMTPConnector WSTRING 3.23 The SMTP Connector used to send the report as an email. If this property is blank, the report will not be sent using email.
EmailSubject WSTRING 3.23 The subject line to use when sending the report using email.
MQTTConnection WSTRING 3.25 The MQTT Connection Tag used to publish the report to. If this property is blank, the report will not be published to an MQTT Server.
MQTTTopicName WSTRING 3.25 The Topic Name in the MQTT server to publish the report output. If this property is blank, the report will not be published to an MQTT Server.
UploadURL WSTRING 3.39 The URL to upload the report output. If this property is blank, the report will not be uploaded to a URL.
UploadURLOptions WSTRING 3.39 The URL Options to apply to the transfer.
UploadURLPassword WSTRING 3.39 An optional password value to send in the transfer request. Note: The password value is encrypted and not stored as plain text.
UploadURLUserName WSTRING 3.39 An optional user name to send in the transfer request.

Sending a Report using email

To send a report using email, configure both these properties:

If either of these properties are blank, no email will be sent.

Publishing a report to an MQTT Topic

To publish a report to a topic in an MQTT Server, configure both these properties:

If either of these properties are blank, the report will not be published to an MQTT topic.

Dynamic Properties

The Text Report Tag supports the dynamic properties of the Core Tag plus these properties:

Property Type Description
ReportStatusCode DINT The result of the report run. A zero value shows no error. A non-zero value shows an error occurred running the report.
ReportStatus STRING[120] A text string describing any error when the report was run. An empty string shows no error occurred.
RunCount DINT The number of times the report has been run. This number is reset to zero if the Fernhill SCADA Server is restarted.
EmailSendState USINT A code to show the status of sending the report by email.
EmailSendStateDescription STRING[120] The text description of the EmailSendState property.
MQTTPublishState USINT A code to show the status of publishing the report to an MQTT server.
MQTTPublishStateDescription STRING[120] The text description of the MQTTPublishState property.

EmailSendState Property

The EmailSendState property shows the outcome of sending the report using email. This property can have these values:

EmailSendState Description
1 No report to send.
2 No email address configured.
3 No SMTP server configured.
4 Not yet sent.
5 Send in progress.
6 Send failed.
7 Send completed successfully.

Tag Commands

The Text Report Tag supports these tag commands:

Tag Command Version Description
Run 3.23 Runs the report, which generates the report text from the template.

Edit Report Template

To edit the report template:

  1. Right click on the Text Report tag in Tag Window.
  2. Select Edit Report Template.

Report Template Format

A reports template can contain these types of declaration:

Declaration Description
Text Any text in the report template is passed straight through to the report output.
<!-- Comments --> Comments in the report template are not passed through to the report output. You can use comments to:
  • Temporarily remove part of a report (commenting out).
  • Provide a description of sections of the report.
<?st expression ?> Structure Text (ST) processing instructions introduce IEC 61131-3 Expressions into the report. Each expression is evaluated and the result inserted into the report output. The most common form of expression is a tag reference. For example:

<?st %"Tank Level.DisplayValue" ?>

An example of an expression using the SEL Function:

<?st SEL( %"Pump State", 'Stopped', 'Running') ?>

<?sql [CSV] SQL Statement ?> SQL Statement processing instructions introduce the result of an SQL Statement into the report. For example:

<?sql SELECT FullName,Value
FROM TagDataPointAnalog ?>

Use the optional CSV keyword to format the output using comma separated variables (CSV). For example:

<?sql CSV SELECT FullName,Value
FROM TagDataPointAnalog ?>

Example Text Report

Example report template installed with Fernhill SCADA:

Process Report
~~~~~~~~~~~~~~
<!-- Include the current time in the report. -->
Status at <?st SYS_GET_TIMESTAMP() ?>

Tank Level       = <?st %".Tank Level.DisplayValue" ?>
Tank Temperature = <?st %".Temperature.DisplayValue" ?>
Pump 1           = <?st SEL( %".Pump 1", 'Stopped', 'Running' ) ?>
Pump 2           = <?st SEL( %".Pump 2", 'Stopped', 'Running' ) ?>

The report template would produce this output.

Process Report
~~~~~~~~~~~~~~

Status at 2018-04-22-07:38:55.170

Tank Level       = 4.757 Metres
Tank Temperature = 37.89 °C
Pump 1           = Running
Pump 2           = Running

Relationships to Other Tag Types

The Text Report Tag builds on the features of these tag types:

Further Information

SMTP Connector

To learn about setting up an SMTP connector to send emails.

MQTT Connection

To learn about setting up a connection to an MQTT Server.

Glossary

For the meaning of terms used in Fernhill SCADA.