ON THIS PAGE:
Format
NumberToState(DigitalStateValues [,Datasource] [,DigitalStateSet])
Returns
Returns the name of the digital state that corresponds to the provided digital state value.
Inputs
DigitalStateValues: The values of the digital states which should be converted to their respective names. If you have a tag that returns a collection of digital state values, you can supply the tag name here, using tag syntax (i.e. {tagname})
Behaviour: Required
Dimensions: Collection, SingleValue, MultiCollection
Valid data types: Integer
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 state values to names.
Behaviour: Optional
Dimensions: SingleValue
Valid data types: String
Examples
Expression: NumberToState(1, null, 'OnOffStates')
Result: Returns 'ON' if the assigned name of digital state 1 is 'ON' in the digital state set called 'OnOffStates'.
Expression: NumberToState({Tag1})
Result: Returns the name of every digital state value that {Tag1} returned during the fetch, using the digital state set which is assigned to {Tag1}. Note: This will only work if Tag1 has a digital state set assigned,
Expression: NumberToState({Tag1}, '', 'OnOffStates')
Result: Returns the name of every digital state value that {Tag1} returned during the fetch using the 'OnOffStates' digital state set. Note: Because the 2nd and 3rd parameter are specified, the function ignores whatever is assigned to the tag and will instead use the digital state set provided.
Expression: NumberToState(0, "Oil and Gas Data", "On Off")
Result: Off
Expression: NumberToState(0, null, "Status")
Result: Online
Release History
- NumberToState() 4.6.5
- Changed DigitalStateValues parameter to support MultiCollection values.
- NumberToState() 4.5.1
- Initial version