DataItem Namespace

The DataItem namespace always takes a "local variable," which is always the name of the particular data item that is evaluated or processed. Since the DataItem namespaces are primary in the Platform, you can use the data item name (the local variable) without the namespace prefix. However, best practices dictate that you always use the namespace prefix, if only to make debugging easier.

Important!

When parsing an expression for a data item name, the rules engine interprets a space as separating the names of two variables. Therefore, it is very important that the names of new data items NOT contain any spaces.  If you have existing data items with spaces in the names, enter the following characters instead of the space in the expression rule field: $S. For example, if the name of the data item is "Machine State", enter "Machine$SState". Note that you cannot use two consecutive spaces nor can you use leading or trailing spaces. Continuing the previous example, the following data item names cannot be used: " Machine" (leading space or "$SMachine"), "Machine " (trailing space or "Machine$S)), and "Machine   State" (multiple consecutive spaces or "Machine$S$S%SState").

In addition, the parser interprets the string that follows the last dot (.) in the variable as the symbol of the namespace. If the name of a data item contains dots, make sure that you use the symbol name. For example, if you want to test the value of the data item named "temp.AMreading.1", you must include the value symbol, as follows: DataItem.temp.AMreading.1.value

Although you could use the name of a data item without using the value symbol, the rules engine cannot parse the expression if the name of the data item is (or contains) the name of a symbol for the DataItem namespace. For example, the symbol "age" might be the name of a data item, or the name might include ".age", as in "temp.age". To get the actual value of the data item, you must use at least "age.value" or "temp.age.value" and it would be even better to include the namespace, "DataItem.age.value" or "DataItem.temp.age.value". For this reason Axeda recommends that you always include the "value" symbol when you want to retrieve the value of the data item for comparison.

If you are using SNMP and data item names contain colons, you MUST use the escape sequence, $C, when using these data item names in an expression. For example, when you want to refer to a data item named 'Temp:12' in an expression rule, you need to use 'Temp$C12' in the rule for the data item to resolve to its current value. When updating that data item through an action, you need to use the actual data item name as a string variable: SetDataItem("Temp:12", 20).

If the symbol provides a string that will be used in comparisons, that value will be case-sensitive. For example, make sure the alias value is written in the correct case for comparison:

If DataItem.AD45.alias = "TempAlias" Then ).

Use this namespace with asset-related triggers and NOT with system-related triggers. See Using Appropriate Actions and Namespaces with Triggers for Expression Rules.

The following table shows the qualified and unqualified use of the symbols for the DataItem namespace. Note that you must always use the name of the data item, which is indicated by "<dataItem_name>" in the table. The table also shows the data type of each symbol and supported values. Note that whether Qualified or Unqualified, the name of the data item (the local variable) is required.

 

Qualified

Unqualified

Returns

Supported values

DataItem.<dataItem_name>.type

<dataItem_name>.type

String

Note: This symbol is case-sensitive.

"number", " ", "string"

DataItem.<dataItem_name>.time

<dataItem_name>.time

Long

The time that the data item was posted to the server, in seconds since 1970.

*DataItem.<dataItem_name>.value

<dataItem_name>.value

Object (Return type depends on data item type)

Any value of one of the specified types.

*DataItem.<dataItem_name>.last

<dataItem_name>.last

Object (Return type depends on data item type)

Any value of one of the specified types.

*DataItem.<dataItem_name>.changed

<dataItem_name>.changed

Boolean

* 0 or false indicates that the value of the data item has not changed since the last time it was posted to the Axeda® Platform. 1 or true indicates that the value of the data item has changed since the last posting.

DataItem.<dataItem_name>.alias

<dataItem_name>.alias

String

Note: This symbol is case-sensitive.

Any string that provides another name for the data item.

DataItem.<dataItem_name>.unit

<dataItem_name>.unit

String

Note: This symbol is case-sensitive.

String of Unit.shortname, if it exists. Otherwise, Unit.fullname.

 

DataItem.<dataItem_name>.description

<dataItem_name>.description

String

String entered by user to explain the data item.

DataItem.<dataItem_name>.age

<dataItem_name>.age

Long

The elapsed amount of time since the data item was last posted, in seconds.

* The changed symbol returns a Boolean. The value and last symbols can return a Boolean. For any symbol that returns a Boolean, do NOT use an operator and value to test for a value of true or false. Use only the namespace and symbol to test for a value of true; use the NOT (!) operator and then the namespace and symbol to test for a value of false. See also Creating IF comparisons with Boolean or non-Boolean values

 

Note: You can use data items sent in by the Axeda Gateway, Axeda Connector, and Axeda® IDM Agents, data items that are set by the Platform (for example, set by the execution of a rule), or data items set programmatically through the Axeda Platform SDK.

Examples

To use a data item value to generate an alarm, you could create the following expression:

 Trigger: Data

 If DataItem.temp.value > 8 || DataItem.temp.value < 2

 Then CreateAlarm("tempAlert", 200, "Temperature is " + str(DataItem.temp.value))

In this example, the value of the data item called temp will generate an alarm if its value is less than 2 or greater than 8. The name of the alarm is "tempAlert." The severity of the alarm is 200, and the message states, "Temperature is <the current value of temp>".

To compare the timestamp of the data item temp, use the Now() function. For example:

 If DataItem.temp.time < Now()-60
Then

To test the value of a digital data item:

 If DataItem.EE425_DI.value == 1.0