Import Types¶
To import files, one needs first of all to define an import type, i.e. the structure of the file(s) that will be uploaded.
In a second step it is possible to actually import datafiles.
Define a new import type¶
To define a new import type go under ADMIN->Imports->Types.
It is possible to modify an existing import type or to create a new one, with the following fields:
- ID: a univocal integer code,
- Code: import code to use in the web API,
- Name: read-friendly name to visualize,
- Title: read-friendly title,
- Check null values: prompt an error message if a KPI value is null,
- From Who Enabled: shows which elements of the Business unit hierarchy are enabled for the import; an element at the top of the hierarchy can import also for all the elements below it,
- Is Enabled: sets if the import is enabled,
- Check Header: check if the column names in the file correspond to the column names defined here.
- Import Values Type: set how KPI codes and values are strucutred in the file; see below.
- Enabled Period Type: select which period types are allowed for this import.
- Enabled Period Frequency Type: select which period frequency types are allowed for this import.
Then click “Add column for import definition” to add a column, with the followng filters:
- Code: to be chosen between a reserved code and the Kpi Filter Level code,
- Col number: the number of the column in the imported file,
- Header text: name of the column in the file,
- Is mandatory: if True, gives an error if a cell is empty,
- Is end of file: if True, the procedure stops after finding an empty cell in this column,
- Is generic filter: True if the filter is generic, False for a reserved filter,
- Level ID: ID of the Kpi Filter Level o None if reserved filter,
- date_filter: True if filter is of type “date”.
Reserved “Code” values are:
- area : identifies an area in the business unit hierarchy,
- country : identifies a country in the business unit hierarchy,
- bu : identifies a business unit in the business unit hierarchy,
- sub_bu : identifies a sub-business unit in the business unit hierarchy,
- kpi_code : identifies the KPI code,
- kpi_value : identifies the KPI value,
- currency : identifies the currency (euro, dollar, etc…).
- iso_code : identifies the iso_code in the By Whom hierarchy
- direct_pc : if previous column in ‘Accepted’, the field is mandatory with Y or N value. In this case the field must be also a generic filter
Repeat “Add column for import definition” for every column in the import file. At the end click “Save”.
The procedure will loop over the file rows, and stop whenever an empty entry in the column marked as “is_end_of_file” is found.
File structure¶
Under “Import Values Type” one can select three different types of file structure:
- 1 KPI x row - fixed position
- N KPI x row - fixed position
- Auto KPI x row - position by header name on right columns
If you select “1 KPI x row - fixed position” you must include the “kpi_code” column and add this column in the import file. If you select “N KPI x row - fixed position” you cannot include “kpi_code” column, but you have to include one column for each KPI you would like to import with the “kpi_code”.
{
'column_code': 'kpi_value',
'column_number': 7,
'header_text': 'Value',
'kpi_code': 'A1',
'is_mandatory': False,
'is_end_of_file': False,
'is_generic_filter': False,
'kpi_filter_level_id': None
},
{
'column_code': 'kpi_value',
'column_number': 8,
'header_text': 'Value',
'kpi_code': 'A2',
'is_mandatory': False,
'is_end_of_file': False,
'is_generic_filter': False,
'kpi_filter_level_id': None
}
If you select “Auto KPI x row - position by header name on right columns” you must include only one “kpi_value” columns with empty “kpi_code”. In each column of the import file you must set the kpi code as column name.
{
'column_code': 'kpi_value',
'column_number': 8,
'header_text': 'Value',
'kpi_code': '',
'is_mandatory': False,
'is_end_of_file': False,
'is_generic_filter': False,
'kpi_filter_level_id': None
}