Integer Columns
How to add an integer column to your importer through code.
You can add a column to your importer directly through the UI of your Fuse account, or you can do so in code using the documentation below.
The Integer column type accepts whole numbers (integers) as input. It supports functionalities such as:
- Validate that input is greater than or less than a certain number
- Round values to the nearest integer
addColumn Function
The addColumn
function accepts an object as an argument.
internal_key
(String) - required: The internal key used to access a column’s value.label
(String) - required: The user-facing column label that is shown in the interface.column_type
(String) - required: Should be “integer”.required
(String) - required: Whether or not the column is required.position
(Optional): The position or order of the column.unique
(Optional): Whether values should be unique.validations
(Optional): An array of built-in data validations. See Built-in Integer Validations.transformations
(Optional): An array of built-in data transformations. See Built-in Integer Transformations.
Example Code
Built-in Integer Validations
The addColumn
object accepts an array of validations. Each validation has three properties:
validation_type:
the name of the validationmessage:
the message showed to the end user if the validation failsoptions:
options for the specific validation type
The validations property accepts an array of objects that contains these possible values: validation_type
, message
and options
. As the example below:
less_than
Specifies that the value must be less than a certain number.
greater_than
Specifies that the value must be greater than a certain number.
even
Specifies that the value must be even.
odd
Specifies that the value must be odd.
regex
Specifies that the value must match a regex
Built-in Integer Transformations
The options property of addColumn
accepts an array of transformations. For the integer transformations, you can specify one property:
transformation_type:
the name of the transformation
The transformations property accepts an array of objects that contains these possible values: transformation_type
. As the example below:
round
The round transformation rounds the integer values in the column to the nearest whole number. For example, 36.6 becomes 37.
floor
The floor transformation rounds down the integer values in the column to the nearest whole number that is less than or equal to the original value. For example, 9.8 becomes 9.
ceiling
The ceiling transformation rounds up the integer values in the column to the nearest whole number that is greater than or equal to the original value. For example, 9.2 becomes 10.