Template Syntax

<< Click to Display Table of Contents >>

 

Template Syntax

To extract the content of a message, users must declare a Template, which allows informing that message's format and which parts must be transformed into data. Templates can have a JSON, CSV, or XML type. Each Template must use keywords, which must replace the values to extract. The available keywords are described on the next table.

Available keywords for Templates

Keyword

Description

TS_TEXT(format)

Timestamp, as a text, used as a Block Tag's or I/O Tag's timestamp. The meaning of each field is described on table Available options for the TS_TEXT keyword

TS_UNIX

Timestamp, in seconds, since 1970 (UNIX format). This value can be a number or a text, and it is used as a Block Tag's or I/O Tag's timestamp, such as 1504198675 or "1504198675"

TS_DAYS1900

Timestamp, as a number, with the number of days since Jan,1st 1900, also known as Gregorian calendar, used as Block Tag's or I/O Tag's timestamp, such as 43595.37373843. This keyword is only available for Templates in JSON or XML format

TS_UNIX_TZ_SECONDS+

TS_UNIX_TZ_SECONDS-

Timezone, in seconds, informed separately from the TS_UNIX keyword. User must inform a + (plus) or - (minus) symbol to indicate whether seconds must be added or subtracted, respectively, from the TS_UNIX keyword to represent a message's timestamp. This keyword is only available for Templates in JSON format

QL_OPC

Quality, in OPC DA standard, using a byte. This value is used directly as a quality value in a Block Tag or I/O Tag, without transformations. Please check table OPC DA standard for more information

QL_BOOL

Quality, in Boolean standard. If a value is greater than 0 (zero) or a "true" or "TRUE" expression, quality is good. If a value is equal to 0 (zero) or a "false" or "FALSE" expression, quality is bad

V1, V2, ... V50

Declares one or more values, which can be extracted individually for I/O Tags, by specifying a third addressing parameter (param). If all values of a message are mapped to a single Block Tag, then users can use an E3VAL keyword for any value to extract, indistinctly

E3VAL

Specifies a value that is extracted in the sequence it occurs for a Block Tag, each value to its own Block Element. If there is only one E3VAL value in the message, the Template can also be used with an I/O Tag

DUMMY

A variable field, but whose value must not be sent to I/O Tags

Repeat_E3VAL

Keyword that can only be used inside a JSON Array, to indicate that the repeating members shall be processed independently, returning a read operation for each appearance. For more information, please see the section JSON Template .

 

Available options for the TS_TEXT keyword

Option

Description

%a

Short weekday

%A

Full weekday

%b

Short name of the month

%B

Full name of the month

%C

Century

%d

Day of the month, starting with 0 (zero)

%e

Day of the month, starting with a space

%f

Milliseconds, from 0 (zero) to 999

%h

Hour, in 12-hour format

%H

Hour, in 24-hour format

%m

Month

%M

Minute

%p

AM or PM

%S

Seconds

%y

Year with two digits

%Y

Year with four digits

%Z

Name of a timezone, an international code that transforms time to GMT

%+

GMT offset in the format +-HH:MM

 

Examples of timestamps formatted using the TS_TEXT keyword:

"2014-07-11T15:26:37Z" -> "TS_TEXT(%y-%m-%dT%H:%M:%SZ)"
"Mon Jul 10 11:04:47 BRT 2017" -> "TS_TEXT(%a %b %d %H:%M:%S %Z %Y)"
"2018-05-02T10:29:28.622-02:00" -> "TS_TEXT(%Y-%m-%dT%H:%M:%S.%f%+)"

 

OPC DA standard

Bit

7

6

5

4

3

2

1

0

Description

Q

Q

S

S

S

S

L

L

 

Available options for the OPC DA standard

Option

Description

QQ

Two quality bits

SSSS

Four sub-status bits

LL

Two limit bits

QQ

0: BAD, 1: UNCERTAIN, or 3: GOOD

SSSS

0: BAD_NONSPECIFIC, 1: BAD_CONFIGERROR, 2: BAD_NOTCONNECTED, 3: BAD_DEVICEFAILURE, or 4: BAD_SENSORFAILURE

SSSS

0: UNCERT_NONSPECIFIC, 1: UNCERT_LASTUSABLEVALUE, or 4: UNCERT_SENSORNOTACCURATE

SSSS

0: GOOD_NONSPECIFIC, 1: GOOD_LOCALOVERRIDE, or 6: GOOD_NONSPECIFICLOCALTIMESTAMP

LL

0: FREE, 1: LOW, 2: HIGH, or 3: CONST

Was this page useful?