Import Foundamentals
Estimated reading: 3 minutes
To configure a new import procedure, please go to the menu: System > Tools > Import.
In the first page after clicking on the menu, you can see a grid of all Imports already configured in your Deepser.
To see the configuration for a specific import, click on the row in the grid. Press ‘Add Import’ to create a new one.
Then we can see the Import configuration form:
The Fields have the following meaning:
FIELD | MEANING |
Name | Name of the Import. |
Model | Model of the entities that are going to be imported into Deepser (Operations, CI, Companies etc.). |
Type | Format of the source file containing the records to be imported in Deepser. |
Has Header (Yes/No) | The first row of the file is an header. If Yes, Deepser will ignore the data of the first row of the Excel File. |
Cron Expression | If the first row of the Excel file is a document header, it cells can be automatically recognaised as entity fields, this comes handy during the binding process |
Status | If Enabled the import will run, otherwise not. |
File Path | It is used to upload the source file containing the records to be imported. |
Path Expression | It is used to dynamically change the name of the file, containing the data to be imported. We will explain this field with an example, below in this document. |
Entity – File – Code | In this field there is the configuration of the ‘File Column – Entity Field’ binding. Entity: Model field; File: File column; Code: script to perform specific manipulations of data on the column value (e.g.: format a date, convert a value, etc.), executed during the cell evaluation. |
Before Run | Custom PHP code to be executed before the import procedure starts. It is used (see examples below) to pre-load data in memory, in order to avoid subsequent massive SQL queries to the DB. e.g.: Load the content of a DB table inside an Array. This action can then be used during the import, to avoid querying the database for every Excel file row. |
Before Row | Custom PHP code to be executed before each Excel file row is imported. It is used (see examples below) to dynamically change the values of the row imported. e.g.1: for every row imported we want to set the status as “New”. We can specify that inside this field. e.g.2: we want to load a record of the DataBase instead of importing a new record. We can load the record from the DataBase here, or read the record from the Before Run Array, representing the data on the DB Table. |
After Row | Custom PHP code executed after each row, as soon as every single record has been saved. It is executed multiple times after every row insert/update. |
After Run | Custom PHP code executed after all Excel file rows have been imported. It can be useful to perform custom tasks at the end of the import. |