Skip to main content
Version: 7.9


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


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.


toLong(value[, failover])

  • Parameters

    • object value - The value to type cast.

    • object failover - Optional. The failover value if type casting fails.

  • Results

    • Long - The value type cast as a long.


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 an number.