Skip to main content
Version: 8.1

toLong

This function is used by Ignition's Expression language..

Description​

Tries to coerce value into a long (64-bit integer). If value is a number, the conversion is direct. If value is a string, it is parsed to see if it represents a long. If not, type casting fails. Will round if appropriate.

Syntax​

toLong(value, [failover])

  • Parameters

    • Object value - The value to type cast.

    • Object failover - The failover value if type casting fails. [optional]

  • Results

    • Long - The value type cast as a long.

Examples​

Code Snippet
toLong("38") //returns 38
Code Snippet
toLong("33.9") //returns 34
Code Snippet
toLong({Root Container.TextField.text}, -1) //returns the value in the text box as an long, or -1 if the value doesn't represent a number.