Skip to content

AsFloat

mapping category: type-conversion no `||`

Transforms any type of input into a floating point value.

Integers are simply cast to floats and dates are stored as their seconds representation. Strings are parsed as a float; if parsing fails, the record fails transformation. Supply a default value to substitute when the string cannot be parsed.

Parameters

1default Optional — accepts: FLOAT, NULL

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

Input type

  • DATE
  • FLOAT
  • INT
  • STRING

Output type

  • FLOAT

Examples

Default — fail on unparseable input

AsFloat()

Default to 0.0 when unparseable

AsFloat(0.0)

Default to NULL when unparseable

AsFloat(NULL)

See also

AsInt, AsDate, AsString