Example of CSV import - Creating Locations Please create a complete backup before making any changes to an interface/import. If the result is not satisfying, it can then be restored
Today we will take a look at a practical example of CSV import. Our use case is the automatic creation of locations within i-doit using a CSV import.
This article was last checked for i-doit version 1.17.1
We need the following information to create the individual objects:
The self-created object type Floor/Basement with the object type constant → C__OBJECT_TYPE__FLOOR. Object name → the name of the building, floor or room Location → under which location the object should be located Object type → what type of object it should be Example CSV file for this import:
Import-Location.csv
The structure of the CSV looks as follows:
Import Location.csv 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62 Object title;Location;Object type
HEADQUARTER;Root location;C__OBJTYPE__BUILDING
Basement;HEADQUARTER;C__OBJECT_TYPE__FLOOR
First Floor;HEADQUARTER;C__OBJECT_TYPE__FLOOR
Second Floor;HEADQUARTER;C__OBJECT_TYPE__FLOOR
Third Floor;HEADQUARTER;C__OBJECT_TYPE__FLOOR
Room 0.001;Basement;C__OBJTYPE__ROOM
Room 0.002;Basement;C__OBJTYPE__ROOM
Room 0.003;Basement;C__OBJTYPE__ROOM
Room 0.004;Basement;C__OBJTYPE__ROOM
Room 0.005;Basement;C__OBJTYPE__ROOM
Room 0.006;Basement;C__OBJTYPE__ROOM
Room 0.007;Basement;C__OBJTYPE__ROOM
Room 0.008;Basement;C__OBJTYPE__ROOM
Room 0.009;Basement;C__OBJTYPE__ROOM
Room 0.010;Basement;C__OBJTYPE__ROOM
Room 0.011;Basement;C__OBJTYPE__ROOM
Room 0.012;Basement;C__OBJTYPE__ROOM
Room 0.013;Basement;C__OBJTYPE__ROOM
Room 0.014;Basement;C__OBJTYPE__ROOM
Room 1.001;First Floor;C__OBJTYPE__ROOM
Room 1.002;First Floor;C__OBJTYPE__ROOM
Room 1.003;First Floor;C__OBJTYPE__ROOM
Room 1.004;First Floor;C__OBJTYPE__ROOM
Room 1.005;First Floor;C__OBJTYPE__ROOM
Room 1.006;First Floor;C__OBJTYPE__ROOM
Room 1.007;First Floor;C__OBJTYPE__ROOM
Room 1.008;First Floor;C__OBJTYPE__ROOM
Room 1.009;First Floor;C__OBJTYPE__ROOM
Room 1.010;First Floor;C__OBJTYPE__ROOM
Room 1.011;First Floor;C__OBJTYPE__ROOM
Room 1.012;First Floor;C__OBJTYPE__ROOM
Room 1.013;First Floor;C__OBJTYPE__ROOM
Room 1.014;First Floor;C__OBJTYPE__ROOM
Room 2.001;Second Floor;C__OBJTYPE__ROOM
Room 2.002;Second Floor;C__OBJTYPE__ROOM
Room 2.003;Second Floor;C__OBJTYPE__ROOM
Room 2.004;Second Floor;C__OBJTYPE__ROOM
Room 2.005;Second Floor;C__OBJTYPE__ROOM
Room 2.006;Second Floor;C__OBJTYPE__ROOM
Room 2.007;Second Floor;C__OBJTYPE__ROOM
Room 2.008;Second Floor;C__OBJTYPE__ROOM
Room 2.009;Second Floor;C__OBJTYPE__ROOM
Room 2.010;Second Floor;C__OBJTYPE__ROOM
Room 2.011;Second Floor;C__OBJTYPE__ROOM
Room 2.012;Second Floor;C__OBJTYPE__ROOM
Room 2.013;Second Floor;C__OBJTYPE__ROOM
Room 2.014;Second Floor;C__OBJTYPE__ROOM
Room 3.001;Third Floor;C__OBJTYPE__ROOM
Room 3.002;Third Floor;C__OBJTYPE__ROOM
Room 3.003;Third Floor;C__OBJTYPE__ROOM
Room 3.004;Third Floor;C__OBJTYPE__ROOM
Room 3.005;Third Floor;C__OBJTYPE__ROOM
Room 3.006;Third Floor;C__OBJTYPE__ROOM
Room 3.007;Third Floor;C__OBJTYPE__ROOM
Room 3.008;Third Floor;C__OBJTYPE__ROOM
Room 3.009;Third Floor;C__OBJTYPE__ROOM
Room 3.010;Third Floor;C__OBJTYPE__ROOM
Room 3.011;Third Floor;C__OBJTYPE__ROOM
Room 3.012;Third Floor;C__OBJTYPE__ROOM
Room 3.013;Third Floor;C__OBJTYPE__ROOM
Room 3.014;Third Floor;C__OBJTYPE__ROOM
Since we want to set dependencies that build on each other, it is important to keep a corresponding order for the locations in the CSV file. The root location is always the lowest level and already exists. In this location are the individual buildings, in the buildings the individual floors and in the floors the respective rooms:
Root location → Building → Floor → Room
So in the CSV file the buildings come first, then the floors and last the rooms.
In order to define which object type is to be created in each case, we give the import in each line the object type constant on the way, we find this in the object type configuration:
Now let's look at the configuration for the import, in the upper area we can leave the settings as they are:
Now click Prepare Mapping, after that we can adjust the settings as follows:
Now we are ready and can start the import, in the location view the following picture should appear afterwards:
The configuration of the newly created object type Floor:
August 15, 2024 January 31, 2023