A data template is how you tell Flatfile Portal what you want your data to look like. Using the data template, you can define internal keys, column labels, which columns are required, which columns require validation, and what type of data is to be expected. Whether you are creating a data template automatically from a CSV, manually defining the data template, or just editing it, there are a few important things to know.
To edit a data template, go to the Data templates screen by clicking Templates in the navigation bag on the left hand side of the screen. From here, you can edit any of your existing templates by clicking on it, or you can create a new data template by clicking Create from CSV (to create a data template automatically) or Add data template (to create a data template manually). Please note that the below screenshots and information use the Portal 3.0 and Workspaces method of template building in the dashboard. For more information on how to build your template in Portal 2.0, please see our Portal 2.0 documentation.
From the Edit data template screen, you can view the Edit column window by clicking a column that has already been created or by clicking the +Add column button.
Data templates are primarily organized around columns. Columns have a number of properties that must be defined. Let’s take a look at each one of those now.
Setting a column type tells Flatfile what kind of data to expect to find in certain columns. Setting the type as “string,” for example, will tell Flatfile to expect some kind of text in that column, while setting the type to “boolean” will tell Flatfile to expect a value of either True or False. The available data types are string, number, boolean, category, email, and phone.
Internal keys are unique identifiers used to organize your data when it is exported. When your data is exported, it is exported as a JSON file, and the data is mapped to the internal keys you have set. JSON is a lightweight, easy to read data format typically used to transfer data between servers and web pages.
Column labels are exactly what they sound like: the labels you want the columns in your data to have. These labels can be anything you want. These labels should be clear and useful labels for you and anyone working with your data, but what they are is up to you.
In addition to the three required settings above, each column also has a number of optional settings that can help you further define what you want to happen to your data.
Clicking the Set regex validation checkbox allows you to set a regex pattern and certain flags to validate and transform your data as it comes in.
If you find that there is a validation or transformation you cannot do using a regex pattern, you might consider using a Data Hook® instead. Data Hooks are one of Flatfile’s most powerful data validation tools.
You may consider including a short description of the column in your data template. This is entirely for your records, and will not affect the way data is validated or transformed.
This is where you tell Flatfile how to treat the data it finds. You can designate data as required, request that the field be unique, or use it as a primary identifier to keep track of updates to existing data.
The Edit data template screen also has some additional tabs to help you further define and refine your data onboarding experience. Clicking on the JSON tab will take you to an editable, JSON version of your data template. If you are more comfortable defining your data using JSON, you can use this screen to edit any of the column options above.
You can also access the Data Hooks screen using these tabs. To learn more about Data Hooks, see our Data Hooks documentation.