toFloat
This function is used by Ignition's Expression language.
Descriptionβ
Tries to coerce value into a float (32-bit floating point value). If value is a number, the conversion is direct. If value is a string, it is parsed to see if it represents a float. If not, type casting fails.
Syntaxβ
toFloat(value[, failover])
Parametersβ
| Type | Parameter | Description |
|---|---|---|
| Object | value | The value to type cast. |
| Object | failover | The failover value if type casting fails. [optional] |
Resultsβ
Float - The value type cast as a float.
Examplesβ
Code Snippet
toFloat("38.772") //returns 38.772
Code Snippet
toFloat({Root Container.TextField.text}, 0.0) //returns the value in the text box as a float, or 0.0 if the value doesn't represent a number.