Contact Us

If you still have questions or prefer to get help directly from an agent, please submit a request.
We’ll get back to you as soon as possible.

Please fill out the contact form below and we will reply as soon as possible.

  • Home
  • Knowledge base
  • Contact Us
  • Home
  • Scripting & Variables

System variables

Written by Mads Mikkelsen

Updated at February 3rd, 2022

Contact Us

If you still have questions or prefer to get help directly from an agent, please submit a request.
We’ll get back to you as soon as possible.

Please fill out the contact form below and we will reply as soon as possible.

  • Installation & Technical information
    Introduction SIA Connect Standalone SIA Connect ANY-Ware Cellular & WiFi connectivity
  • Configuration in the Web UI
    Getting started with the UI Connectors Instances Items Mapping Data System Network Tools & Add-ons DigiCert IoT Trust Manager
  • Connectors
    Siemens S7 Azure IoT Ethernet/IP Mitsubishi MELSEC OPC-UA Server SQL MQTT Omron Host Link REST API Omron FINS Keyence Beckhoff TwinCAT BACnet Virtual OPC-UA Client MS SQL File M-Bus Modbus
  • Scripting & Variables
    Data formatting
  • Developers
    API documentation Shadow API
  • Tutorials & Guides
    InfluxDB AWS IoT Core - Amazon Web Services Microsoft Power BI KaaIoT Siemens S7 AVEVA Insight SIA Connect Demo Rack Grafana Azure
  • General
+ More

Articles in this section:

  • System variables
  • Instance variables
  • Item variables
  • Post processing of data
  • Using payloads & wrapping out JSON parameters

Table of Contents

UID and name referencingTime variablesFormatting of timeSIA variables

System variables are variables that are related to SIA such as UUID and time. 

This articles contains all the accessible system variables that can be used when scripting and processing in SIA.

Info

To identify variables they need to be wrapped in % e.g.: %TIME%.
Variables are case-insensitive

Note

The keyword value (without being encapsulated with %) will return the actual current value of the item (even before being post-processed).

Warning

For certain values, please use quotes to turn that value into a string. 

If this is not done, the JS parser will also evaluate the expression.
For example, a date containing - / etc would break the parsing, showing JS errors.


UID and name referencing

Any item or instance can be referenced to by calling it by its UID or name. This makes information, parameters and values from instances and items accessible all across SIA.

Reference Description Example
UID An instance and item can have a UID. By referencing to this it is possible to access its variables.
Check the following articles for setting UIDs for instances‍ and items‍  
UID: BOTTLE_COUNTER (value variable)
%BOTTLE_COUNTER.VALUE%
NAME The item or instance the variable should point at can also be referenced by its name. Spaces will be replaced by _ and special characters removed. NAME: Speed setpoint (value variable)
%SPEED_SETPOINT.VALUE%


Warning

Referencing by name might not work as intended if multiple items or instances shares the same name or UID.
If there is a conflict between name and UID the UID. 


Time variables

%VARIABLE% Description Example
VALUE.TIME Timestamp of the value associated to an item. 2021-12-31T14:00:00
TIME Current system time in UTC.
Default format: yyyy-MM-ddTHH:mm:ss
%TIME%
TIME_UTC

NOW 2021-12-31T14:00:00
TIME_LOCAL
Current system time in local time.
Default format: yyyy-MM-ddTHH:mm:ss
%TIME_LOCAL%
2021-12-31T15:00:00
EPOCH_TIME The epoch / Unix timestamp which is given in s since January 1, 1970 %EPOCH_TIME%
UNIX_TIME 1640959200
EPOCH_TIME_MS The epoch / Unix timestamp which is given in s since January 1, 1970 given in ms %EPOCH_TIME_MS%
UNIX_TIME_MS 1640959200000


Formatting of time

Time variables can be formatted so you can tailor and format so it matches into your requirements and needs.
In order to use time format you have to apply .FORMAT to the time format:

%TIME.FORMAT("yyyy-MM-ddTHH:mm:ss")%
%VALUE.TIME.FORMAT("yyyy-MM-ddTHH:mm:ss")%


The following tables shows all the format specifiers:

Format specifier Description
d The day as number without a leading zero (1 to 31)
dd The day as number with a leading zero (01 to 31)
ddd The abbreviated localized day name (e.g. 'Mon' to 'Sun')
dddd The long localized day name (e.g. 'Monday' to 'Sunday')
M The month as number without a leading zero (1-12)
MM The month as number with a leading zero (01-12)
MMM The abbreviated localized month name (e.g. 'Jan' to 'Dec')
MMMM The long localized month name (e.g. 'January' to 'December')
yy The year as two digit number (00-99)
yyyy The year as four digit number


Format specifier Description
h The hour without a leading zero (0 to 23 or 1 to 12 if AM/PM display)
hh The hour with a leading zero (00 to 23 or 01 to 12 if AM/PM display)
H The hour without a leading zero (0 to 23, even with AM/PM display)
HH The hour with a leading zero (00 to 23, even with AM/PM display)
m The minute without a leading zero (0 to 59)
mm The minute with a leading zero (00 to 59)
s The second without a leading zero (0 to 59)
ss The second with a leading zero (00 to 59)
z The milliseconds without leading zeroes (0 to 999)
zzz The milliseconds with leading zeroes (000 to 999)
AP or A Interpret as an AM/PM time. AP must be either "AM" or "PM"
ap or a Interpret as an AM/PM time. ap must be either "am" or "pm"

    

SIA variables

%VARIABLE%
Description
Example
UUID
The system UUID
%UUID%
d20c87c7-7fc5-4705-941b-c1c0e88facb6
parameters scripting time variables system variables

Was this article helpful?

Yes
No
Give feedback about this article

Related Articles

  • Instance variables
  • Item variables
  • Post processing of data

0
0
Expand