ON THIS PAGE:
Format
ValueCount(Arg1 ,ValueIndex [,DefaultValue])
Returns
Returns the value of an item as a single value variable (i.e. without metadata like timestamp, confidence, etc.) from the given collection variable.
Inputs
Arg1: The collection variable (e.g. tag) which contains the item whose value is to be returned.
Behaviour: Required
Dimensions: Collection
Valid data types: Null, Boolean, DateTime, Decimal, Integer, String, Duration, Error
ValueIndex: The zero-based index of the item whose value is to be returned. Keywords like "first" and "last" can be used to refer to the first and last item in the collection, respectively.
Behaviour: Required
Dimensions: SingleValue
Valid data types: Decimal, Integer, String
DefaultValue: Default value which will be returned if the specified item was not found in the collection variable.
Behaviour: Optional
Dimensions: SingleValue
Valid data types: Null, Boolean, DateTime, Decimal, Integer, String, Duration, Error
Examples
Expression: Value({Tag1}, 0)
Result: Returns the value of the first item that was fetched for {Tag1}.
Expression: Value({Tag1}, 'first')
Result: Returns the value of the first item that was fetched for {Tag1}.
Expression: Value({Tag1}, 4, 0)
Result: Returns the value of the fifth item that was fetched for {Tag1} however if it was not found then it returns the default value, 0.
Note: The function is applied to fetched data, it does not affect the way data is fetched.
Release History
- Value() 4.10.4
- Initial version