For a Data Item rule, a dataItemList object is passed to the scripting engine. The dataItemList object is a list containing data items (dataItemList objects). Use the following sample code to iterate through a dataItemList object:
for
(Iterator i = dataItemList.iterator;i.hasNext();)
{
DataValue value = (DataValue) i.next();
}
Note: The "DataItemList" global variable was referred to as "values" in previous releases.
The custom Data Item object provides the attributes listed in the following table; use the methods shown below in your custom object code to retrieve a value for each attribute:
Attribute |
Method |
Data Item Name |
value.getDataItem().Name() |
Data Item Type |
value.getDataItem().getType() |
Data Item Unit Name |
value.getDataItem().getUnit().getName() |
Data Item Unit Description |
value.getDataItem().getUnit().getDescription() |
Data Item Unit TYpe |
value.getDataItem().getUnit().getType |
Data Item Model Name |
value.getDataItem().getModel().getName() |
Timestamp |
value.getTimestamp() |
Data Item value as Boolean |
value.asBoolean() |
Data Item value as Double |
value.asDouble() |
Data Item value as Integer |
value.asInteger() |
Data Item value as Long |
value.asLong() |
Data Item value as String |
value.asString() |