DText() Function
- Last UpdatedFeb 21, 2017
- 1 minute read
In a script, you can convert a Boolean value to a string value by using the DText() function. You can use this function to use customized message display animation links.
This function returns different string values depending on the value of a Boolean value.
Syntax
result = Dtext (Boolean, stringtrue, stringfalse)
Parameters
Boolean
A literal Boolean value, discrete tagname, or Boolean expression.
stringtrue
The string to be returned if Boolean is true. A literal string value, message tagname, or string expression.
stringfalse
The string to be returned if Boolean is false. A literal string value, message tagname, or string expression.
Example(s)
This script returns "Running" if the discrete tagname switch is TRUE, otherwise it returns "Stopped".
DText(switch,"Running","Stopped")
This script returns the On and Off Messages of another discrete tag switch2 depending on the value of the discrete tag switch1.
DText(switch1,switch2.OnMsg,switch2.OffMsg)