Text Report Tag

Help Contents

Introduction

The Text Report TagReport 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:

PropertyTypeVersionDescription
RunIntervalTIME3.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.
RunOffsetWSTRING3.23 The offset added to the RunInterval to get the actual time the report is run.
EmailAddressWSTRING3.23 The email address to send the report to. If this property is blank, the report will not be sent using email.
EmailSMTPConnectorWSTRING3.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.
EmailSubjectWSTRING3.23 The subject line to use when sending the report using email.
MQTTConnectionWSTRING3.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 Broker.
MQTTTopicNameWSTRING3.25 The Topic Name in the MQTT Broker to publish the report output. If this property is blank, the report will not be published to an MQTT Broker
UploadURLWSTRING3.39 The URL to upload the report output. If this property is blank, the report will not be uploaded to a URL.
UploadURLOptionsWSTRING3.39 The URL Options to apply to the transfer.
UploadURLPasswordWSTRING3.39 An optional password value to send in the transfer request. Note: The password value is encrypted and not stored as plain text.
UploadURLUserNameWSTRING3.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 Broker, 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:

PropertyTypeDescription
ReportStatusCodeDINT The result of the report run. A zero value shows no error. A non-zero value shows an error occurred running the report.
ReportStatusSTRING[120] A text string describing any error when the report was run. An empty string shows no error occurred.
RunCountDINT The number of times the report has been run. This number is reset to zero if the Fernhill SCADA Server is restarted.
EmailSendStateUSINT A code to show the status of sending the report by email.
EmailSendStateDescriptionSTRING[120] The text description of the EmailSendState property.
MQTTPublishStateUSINT A code to show the status of publishing the report to an MQTT Broker.
MQTTPublishStateDescriptionSTRING[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:

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

Tag Commands

The Text Report Tag supports these tag commands:

Tag CommandVersionDescription
Run3.23Runs 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:

DeclarationDescription
TextAny 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 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 Command ?> SQL Command 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 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 CONCAT( %".Tank Level.DisplayValue", " ", %".Tank Level.DisplayUnits" )?>
Tank Temperature = <?st CONCAT( %".Temperature.DisplayValue", " ", %".Temperature.DisplayUnits" ) ?>
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 Broker.

Glossary

For the meaning of terms used in Fernhill SCADA.