Creating tables
Data tables are repositories for any kind of information. Data from tables can be displayed in an email or used for customer segmentation.
You can see how data tables are used in real projects using the example of one of our clients.
Data tables are located in the Tables section of the enKod menu.
To create a new table, you should specify a name, add the necessary columns and their data type. For the name of the table itself or its columns only Latin characters in lower case without spaces are allowed, also digits and the symbol '-', '_' (cannot start with a digit, '-', '_').
Primary key - is used for uniqueness of data in the table. When adding new rows manually or via import, the data will be checked for uniqueness by this column. You can set several primary keys, then the reconciliation will be performed by their combination, which must be unique.
You cannot change/add a primary key in a table that already has data.
Column mandatory - mark for the column that when adding new rows manually or via import, this field must be filled in, otherwise the row will not be added.
Default value - when creating a table, you can fill any column with a single value if this field is blank when adding a new row. When editing an existing data table, you can set a default value only for columns in which no cells are already filled.
Editing a table
To edit columns in a table, as well as copy or delete it, click on the corresponding icon when hovering over the desired table. Similar operations can be performed from the table details by pressing the “Actions” button.
Please note that you cannot change a column's data type if it already has some data in it.
Adding a row manually
To add a row to a table manually, go to its details by clicking on its name in the table list.
Next, click on “Add a new row”. Fill in the fields with the required values and click on “Create”.
In the table search bar you can search for the required data by any field of the table.
Import to table
To import a file into a data table, you need to open the table view and click the “Import to table” button
After loading the file, it is necessary to match the table columns with the columns from the file, if it was not done automatically, here you can also select the columns that do not need to be imported
After the import is started, the reconciliation of the file will start. To continue the import after the reconciliation is completed, go to the enKod » Imports section of the system, find the required import in the list and press the “Start import” button.
In the import settings window you should choose what to do with new, duplicate or incorrect lines, if any.
Note that if a primary key is present, you will not be able to load rows with matches for this key into the table. In addition, if there are duplicate rows in the file, you will not be able to load them if the primary key is present.
After pressing the “Start import” button, wait for the import process to complete. Import details can be viewed in the list of imports by pressing the “Open history” button
Please note that invalid rows are stored for 10 days, you should unload them before the moment specified in the import history window. You will not be able to do it later
Adding a row by API
You can familiarize yourself with all currently available methods for working with data tables by API in this section of the manual.
All string and text parameters in queries (for example: date in the format yyyyy-mm-dd, date-time in the format yyyyy-mm-dd hh:mm:ss, e-mail in the format [email protected]) should be wrapped in quotes.
Data type
The following data types are allowed for importing and manually adding strings:
- Number - integers, from minus 9 to plus 9 digits;
- Fractional number - from 9 decimal places before and after the decimal point, including negative values. To separate the integer part, use a full stop, not a comma, using a comma will cause an error;
- Email - in the format [email protected], serves for communication between mailing groups and data tables. Thus, if subscribers' addresses are specified in fields not with the “email” type, such a table cannot be used for segmentation;
- Phone - a string (from which all extra characters will be removed), “+()-” characters are allowed, space is not allowed;
- Text - any characters;
- Logic type - logical value with values true/false or 0/1;
- Date - strictly in yyyyy-mm-dd format or in timestamp format (only for updating by API) (note: 1620853200);
- Date-time - strictly in yyyyy-mm-dd hh:mm:ss format or in timestamp format (only for updating by API) (note 1620853211).
- The formats “yyyy-mm-dd” and “yyyyy-mm-dd hh:mm:ss” are not changeable. That is, importing strings with the format “yyyy-mm”, “yyyy-mm-dd hh”, “yyyy-mm-dd hh:mm” will result in an error.
- If you need to use a comma inside a text field, use escaping (double quotes on both sides of the comma).
- Separators in a csv file can be either commas or semicolons. Pay attention to the presence of these characters in cell contents to avoid incorrect splitting of data into columns.
DC for working with data tables
You can familiarize yourself with all dynamic content methods for working with data tables in this section of the manual.
Export data table
Exporting a table in csv format is available when opening the table view (LMB on the table name in the list) ➔ Actions ➔ Export table