Skip to content

AsInt

mapping category: type-conversion no `||`

Transforms any type of input into an integer.

Floats are rounded down. Dates are stored as their seconds representation. Strings are parsed as an integer; if parsing fails the record fails transformation. Supply a default value to substitute when the string cannot be parsed.

Parameters

1default Optional — accepts: INT, NULL

Default integer value used when the input is a string that cannot be parsed as an integer. May be NULL.

Input type

  • DATE
  • FLOAT
  • INT
  • STRING

Output type

  • INT

Examples

Default — fail on unparseable input

AsInt()

Default to 42 when unparseable

AsInt(42)

See also

AsFloat, AsDate, AsString