ON THIS PAGE:
Format
StateToNumber(DigitalStateNames [,Datasource] [,DigitalStateSet])
Returns
Returns the number value of the digital state that corresponds to the provided digital state text value.
Inputs
DigitalStateNames: The name of the digital states which should be converted to their respective values. If you have a tag that returns a collection of digital state names, you can supply the tag name here, using tag syntax (i.e. {tagname}).
Behaviour: Required
Dimensions: Collection, SingleValue, MultiCollection
Valid data types: String
Datasource: Optional. Name of the datasource to which the digital state set belongs. If this parameter is supplied then the DigitalStateSet parameter must also be specified. Use null if the digital state set is not assigned to a datasource.
Behaviour: Optional
Dimensions: SingleValue
Valid data types: Null, String
DigitalStateSet: Optional. Name of the digital state set which should be used for converting digital states to values.
Behaviour: Optional
Dimensions: SingleValue
Valid data types: String
Examples
Expression: StateToNumber('ON', null, 'OnOffStates')
Result: Returns 1 if the assigned value of digital state 'ON' is 1 in the digital state set called 'OnOffStates'.
Expression: StateToNumber({Tag1})
Result: Returns the value of every digital state name that {Tag1} returned during the fetch using the digital state set which is assigned to {Tag1}.
Expression: StateToNumber({Tag1}, '', 'OnOffStates')
Result: Returns the value of every digital state name that {Tag1} returned during the fetch using the 'OnOffStates' digital state set.
Expression: StateToNumber("On", "Oil and Gas Data", "On Off")
Result: 1
Expression: StateToNumber("Online", null, "Status")
Result: 0
Release History
- StateToNumber() 4.6.5
- Changed DigitalStateNames parameter to support MultiCollection values.
- StateToNumber() 4.5.1
- Initial version