Skip to main content

Column constraints

All you need to know about column constraints

Stéphane Jauffret avatar
Written by Stéphane Jauffret
Updated over a year ago

Columns can have many constraints:

General constraints

General constraints include the following possibilities:

  • Must contain distinct values or not

  • Mandatory/optional

  • Type:

    • Text

    • Boolean

    • Number

    • list of values

    • Date

    • URL

    • Image

    • Mutliline

Each constraint has a list of parameters, such as the format for Date, or the delimiter and number of decimals for Number.

Custom constraints

Wherever the general constraints are not enough you can define your own constraints.

You can define your constraint with validation functions. Here is the list of validation functions that are available today:

  • Check length

  • Check that starts with...

  • Check that ends with...

  • Check that value is between number A and B

  • Check that value is above A

  • Check that value is positive/negative

  • Check dependencies between columns: must be filled if another column is filled

  • etc.

Each validation can be customized by its parameters.

For example :

You can also use regular expressions in constraints, for maximum precision.

As an example, here is a constraint that will check that the zip code column complies with the zip code in the US :

^(\d{5}(?:\-\d{4})?)$

Error handling

Each constraint, whether regular or customized comes with its error handling.

Error handling will help your customers when they encounter errors before they submit your files, so ➡️ they're really important. ⬅️

Error handling consists of solutions that will be presented to your customers. They're a list of choices, that customers can choose from to correct their files automatically if the column does not pass the column's constraint.

💡 Here is an example of error handling that will be shown to your customers for a Price column which needs to have a "." separator.

👉 Your customers will only have to choose among the different solutions and the solution will be applied to the whole column at once, thereby helping them save a ton of time.

Each solution has its set of questions, for example if your customer chooses the first solution above:

📎 If you want, you can refine solutions to add conditions, to make solutions really customized based on particular scenarios you typically find in your business. For example, if you're in the ecommerce business and your customers submit files with EANs that contain only 12 characters instead of 13, you could add a solution that automatically appends a 0 at the forefront of each of the faulty EAN.

In order to implement error handling properly in your account, follow the steps below.

How to implement error handling

For all constraints, error handling is already built-into the system with initial solutions.

You are free to add more solutions to the original error handling. Each error handling you add is particular to a column and a solution.

It is a good idea to look at how the built-in original error handling is constructed, to replicate and adapt your own.

Say you want to create a solution for prefixing the EAN number of someones' file with a given number, that you'll ask your customers.

Step 1 - create the constraint for the EAN column, that should be exactly 13 characters

Step 2 - edit the error handling and add a solution

Give a name to your solution, for example "Add a leading number if EAN is only 12 chars". This name is internal and will be seen only you, not by your customer.

Then edit the question you want to ask your customer, for example "What number do you want to add"

And store the response into a variable for example leading_number. Give it the constraints you want. For example, it has to be an integer.

Then edit the rule :

Your customers will not see the rule, and the rule will be executed automatically as soon as your customer chooses that solution. The rule will be stored in your customer's workflow, so when your customer submits subsequent files, this whole solution and its rules will be executed.

Give a name to the rule, for internal use, for example, "Append the leading number"

Then a condition, so it applies only if the EAN has a length of exactly 12 characters

And add the action, to actually do the work: take the Ean column and put the leading number parameters in front of the Ean column.

As an alternative :

Please note that you could also put the above as a Default transformation rule if you are sure about the answer and this is a common mistake your customers do. In order to do this, click on "default transformation" on the template menu.

And then do this rule:

What's next?

Take Those 2 tours, to create your first custom constraint, with guided help, and then do your error handling for it.

Please visit this page to learn more about rules and their functions

Did this answer your question?