IDEV Online Help
8.3 Data import
For some statistics, data can not only be entered manually into a report form but also be imported from an ASCII or CSV format file. The data of such a file has to be imported based on an import definition. Import definitions are necessary to ensure that the application is able to associate individual imported data items with the appropriate field on the various sections of the relevant report form.
The Import function is used to create and/or edit import definitions for different file formats and to import data from files based on such definitions.

In the Existing import definitions section, all already existing import definitions are shown in a table view listing the definitions with name, file format and creation date. There are basically two types of import definitions that may be listed in this table: predefined import definitions (tagged with "Default") and user-defined import definitions.
Note:
Default import definitions can neither be deleted nor edited.
The following functions are supported:
-
-
Opens the Show import definition dialog to display the highlighted default import definition.
-
-
Opens the Edit import definition dialog to edit the highlighted user-defined import definition.
-
-
Opens the Edit import definition dialog to copy the highlighted default or user-defined import definition and to edit the copy.
-
-
Deletes the highlighted user-defined import definition.
-
-
Opens the Import a file dialog to import data from a file by applying the highlighted import definition.
-
-
Creates a new import definition and opens the Edit import definition dialog to edit the new import definition.
Edit import definition
The Edit import definition dialog is used to define both position information relating to import file contents and pre-fill values for input fields in report forms.

The following functions are supported:
-
-
Saves the displayed import definition.
-
-
Resets all input fields that have been filled in since the last executed action.
-
-
Calculates the positions consecutively.
-
-
Checks calculated positions for overlapping and whether data set types can be uniquely identified.
The Edit import definition dialog provides a table containing the structure of the relevant statistic survey with all substructures and/or fields. Apart from fields, every substructure may also contain further substructures. In the example import definition shown in the above figure, the names of substructures appear as section titles.
Note:
The actual appearance of and the designations in this table are survey-specific.
The example import definition includes the substructures Order fields and Trainees. The fields of the substructure Order fields form a group called an (iterated) field group. This can easily be seen as the field Number of repetitions exists. The fields of the substructure Trainees are a data set type. This is clearly recognizable by the presence of the function bar for data set type definition.
Important note:
In a file to be imported, the data of all fields and field structures has to be specified. Fields and field groups of the main data set must be in the first line but fields and field groups of the data sets must be specifield in separate lines following.
Example of a CSV import file suitable for the import definition shown:
Industry;2013;Berlin;123456
1995;male;132456
1996;female;214212
After this data has been imported from the file, the report form for the relevant statistics would show two entries under the substructure Trainees: one entry for each of the above data sets.
In an import file, the data items of a data set are always arranged one after the other. When data sets that have to be assigned to one and the same substructure include data items with different arrangements, the application needs several data set types to assign the data items correctly to the appropriate fields.
Example of a CSV import file with two data sets:
Industry;2013;Berlin;123456
1995;male;132456
2000;112433;female
These two data sets do not follow the same pattern, so that a second data set type is required for the substructure Trainees to ensure that the second data set can be imported correctly into the report form. For this purpose, the second data set type has to be arranged so the Sex field gets position 3 and the Ident-Nr. field position 2.
Data set type identification in import files is also required when several substructures (apart from those assigned to the main data set) exist in the overall structure of a statistic survey. The assignment of data sets to the appropriate substructure is in this case based on the identification of data set types.
In the table of the Edit import definition dialog, a function bar for data set type definition is displayed for each substructure that is not assigned to the main data set. This function bar looks like this:

The dropdown list box on the left-hand side of the function bar contains all defined data set types from which the required one can be selected for editing. Via the button Add data set type, the user can add a new data set type to the corresponding substructure. Via the button Remove data set type, the selected data set type can be removed.
To ensure that the application can recognize that data sets belong to a specific data set type when data is imported from a file, a unique identification must be possible based on an identifier. This is not achieved through the names of the data set types, but rather by the use of default values, which - via the import definition - are assigned to specific fields.
In the import definition the Year of the birth field has the default value "2000". The position of the data items in the data sets contained in the CSV import file is thus properly indicated. Based on this definition, the application will assign all data sets that have the value "2000" at the first position to the data set type Default, i.e. to the substructure Trainees.
Pre-filling fields through import definitions
When in the data sets contained in an import file a value is missing that is required in a statistic survey, it is possible to assign this value through the import definition, provided that this value is the same in all data sets. In this case, no position is determined for the relevant field so that only a default value is defined for it. After the import of the data from a file, all corresponding fields of the report form are then pre-filled with this default value. This is called preassignement.
Non-occurring value
When a value that is required in a statistic survey does not occur in the data sets contained in an import file and is not to be entered into the report form using the field pre-filling option either, all input fields of the respecting field name must remains empty. When computing positions, the respective field name has to be left out.
Import file
The dialog Import a file appears after clicking on import file for the desired import definition:

Select the desired import file in the field Import file. In the Import from line input field, enter the number of the line beginning with which data sets have to be imported. From the Separator char dropdown list box, select the separator that is used in the CSV import file, adjust other import settings if necessary and then click on the Import into the form button.
Note:
When importing ASCII files, no separator is specified.