The SetDataItem() action creates or updates a data item with a specified value for the associated asset. If the data item does not already exist, the Platform creates the data item as a "local" variable (that is, it has no data item history).
Note: The difference between this action and the SendDataItem() action is that this action sets the data item in the Platform; it does NOT change the value of the data item at the asset. SendDataItem() changes the value at the asset.
SetDataItem(String dataItemName, Object dataItemValue)
where:
dataitem - name of the data item to save to the Platform and to which you want to write the specified value (dataItemValue); case-sensitive.
Important! If your data item names contain colons (for example, SNMP data items), 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).
dataItemValue - value to write to this data item. The value can be of the following data types: Digital (Boolean), Analog (Double), String (String). Make sure the data type of the dataitem supports the value you want to write (for example, do not define a String value for a digital or analog data item).
The following example sets the value of the data item, Temperature, to 36.9:
Then/Else: SetDataItem("Temperature", 36.9)