Item variables can be used to fetch any parameters and data linked to an item such as its name or its connector specific parameters. These can be very handy to use when customizing a payload in a mapping or doing logic.
This articles contains all the accessible item variables that can be used when scripting and processing in SIA.
System variables describes how to reference variables to an item by calling it by its name or UID so instead of %ITEM% the UID or name of a item can be used.
To identify variables they need to be wrapped in % e.g. %BOTTLE_COUNT%.
Variables are case-insensitive
Using %ITEM% without any additional parameters, will return its own NAME.
All the parameters and information that can be accessed from an item are described in the table:
%VARIABLE% | Description | Example |
---|---|---|
ID | The auto-generated ID of the item assigned by SIA | %ITEM.ID% » 5 |
NAME | Name of the item | %ITEM.NAME% » Bottle machine |
DESCRIPTION | Description of the item | %ITEM.DESCRIPTION% » "Machine for bottle handling" |
ENABLED | True for enabled instances & false for disabled | %ITEM.ENABLED% » true |
UID | UID of the item | %ITEM.UID% » BOTTLE_MACHINE |
VALUE | Last stored value for the item | %ITEM.VALUE% » 33 |
VALUE_HIST[index] Available from version 1.0.5 |
Get a historical value for the item. Length of history is defined by the setting historical_data_length (default = 5) |
%ITEM.VALUE_HIST[0]% » 33 (same as %VALUE%) %ITEM.VALUE_HIST[2]% » 31 (previous value) |
VALUE.TIME | Timestamp of the data sample. Check Time variables for all the different time variables. Default format: yyyy-MM-ddTHH:mm:ss |
%ITEM.VALUE.TIME% » 2021-12-31T14:00:00 |
VALUE.TIME.FORMAT |
Timestamp of the data samples in a specified format. Check Time formats for formats |
%ITEM.VALUE.TIME.FORMAT("yyyy-MM-dd HH:mm:ss.zzz") » 2021-12-31 14:00:00.123 |
STORE_TIME | Default store time for the items data under the device given in minutes | %ITEM.STORE_TIME% » 1440 |
STORE_SAMPLES | Default samples to store for the items data under the device | %ITEM.STORE_SAMPLES% » 1000 |
CONNECTOR_SPECIFIC parameters | Specific values for Connectors. E.g. "Address" (DB2.DBW10) & "Type" (WORD, BOOL, ..) for a Siemens Connector. Please refer to the Connectors guides for their parameters |
%ITEM.ADDRESS% » DB2.DBW10 %ITEM.TYPE% » WORD |