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 Broker.
MQTTTopicName WSTRING 3.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
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 username 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.

Data Properties

The Text Report Tag supports the data 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 Broker.
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 the Text Report tag in Tag Window.
  2. Select Edit Report Template.

Report Template Format

A report 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 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 SysGetDateAndTime() ?>

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.