Sometimes, you need to convert a value into a string before it can be used. In the following example, the value of a tag is converted before it is used in the DspStr() function.
Label Name |
ShowVariable(TAG) |
Expression |
DspStr(25, "BigFont", #TAG + "=" + TAG:##.#); |
In the above example, only one argument (TAG) is passed to a function that actually requires three arguments (AN, font and message). When you use this label in a command, the function uses AN 25 and the message displays in "BigFont". Only the third argument (the actual message) varies.
The third argument passed to the function is:
...#TAG+"="+TAG:##.#
#TAG indicates that the name of the tag (and not its value) is displayed.
TAG:##.# indicates that the value of TAG is converted to a string and displayed. It is formatted with two numbers before the decimal point and one number following the decimal point.
You can use the above label in a command such as:
Command |
ShowVariable(SP12); |
When you use this command in your runtime system, the command displays "SP12=<value>", where value is the actual value of SP12 at the time (for example SP12=42.0).
See Also