Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Pictures+default-template

...

To be able to use your data for CSV import it is important to save them in .csv format with UTF-8 encoding. Some spreadsheet applications are not able to set the encoding when saving. In this case you can use a text editor which has a conversion function after you exported your data to .CSV format. In the following screenshot you can see the Convert to UTF-8 function in Notepad++:

Image RemovedImage Added

The structure of a suitable .CSV file is approximately as shown in the following example:

Image RemovedImage Added

The first line is used as a header and serves as the identification of the attribute. Each successive line represents an individual object of your IT documentation.
You can also use your favorite text editor to create csv files.

Image Added

Once the .CSV file has been prepared to this point, you can begin the import.

...

Choose your .csv file in the first step by using the Browse... button and upload the file from your system. Now the file is shown in the list and you can choose the actions Use for import, Download file and Delete file when hovering over the row of the file with the mouse cursor.

Image RemovedImage Added

To get to the next step of the import you need to click Use for import.

...

You have to define some options before the mapping process between the table columns and attributes in i-doit can begin.

Image RemovedImage Added

Object Type

When you select an object type via the drop-down menu Global object type, all objects in the .CSV file will be imported as this type of object. If you do not define a global object type, you require an additional field in the .CSV file to enter the database constant. The object type to which the object will be associated is determined by this constant for every line. This allows you to import objects from different object types (client, printer, monitors ...) from one file. This information has to be maintained for all objects if no global object type is used. You can't use a mixed form.

Separators, Headers and

...

Consider default template

If you use a different separator than the semicolon (;), it is possible to specify the used separator.

If you do not use a header line, you can deactivate the header so that the first line in the .csv file will be interpreted as the first object.

The objects are created with the data from the default template.

Empty Values

If you want to update existing objects with CSV data import, you can decide how you want to handle blank cells in the .CSV file. With the item  Adopt empty values you have the option to choose either Yes or No:

...

As soon as you have adjusted the options you can start with mapping. First of all you can select an object-matching profile if you want to update existing objects. You can edit this profile at a later time.

Image RemovedImage Added

Assignment of Columns to Attributes

Each column receives its own row in the mapping. This way you can link each row of the .CSV file with an attribute from i-doit. Click the pencil icon of the row in order to activate the input field for selecting the associated attribute. The right attribute can now be selected from the drop-down field or you can enter its name directly in the field to use the suggest feature. The input will be confirmed using the Apply button. Link each column this way until all allocations are complete. You can remove allocations subsequently. Columns without an allocation will be ignored during data import.

Image RemovedImage Added

Info
titleMandatory details
Stating the object title and the object type is both mandatory. If you defined a global object type in the data import options, you just have to link the object title with a column in the mapping. If you did not set a global object type, then a link to a column as object type will also be required. Otherwise it is not possible to start the import function. Setting the object type is carried out via its database constant (for example C_OBJTYPE_SERVER). Setting the name of the object type (e.g. “Server”) is not sufficient.

...

Once the import has been completed, information regarding the import as well as a confirmation of its completion will be indicated. The imported or updated objects are linked directly. The content of these objects can be changed manually anytime, if needed.

Image RemovedImage Added

Import of Relations (Linking of Objects)

The CSV import is capable of creating links between objects (relations) if these are set via a category. The object that is to be linked can also be put in a column of the .CSV file while the field for linking can be set as attribute which is to be assigned. An example of a statement of the physical location in column H:

Image RemovedImage Added

After selecting the field during the mapping, you can decide whether the selection of the object you are going to link is made in an unrestricted way or if there will be a restriction to an object type of your choice. Furthermore, objects which could not be found can be created automatically. Setting the object type of the linked objects is required in this case so that an object of this type will be created. For some types of links, it is possible to set the attributes in the special assignment by which the identification is made for the objects that are going to be linked. As a standard, the object title is used.

Info
titleNote
The special assignment cannot be found in all linking fields. If it is not available, only the object title is used for the identification of the object that is to be updated.


Image RemovedImage Added

Import of Values with Units

...

The import of .CSV files can be automated using the controller and a cron job. Use the following csv_import handler:

...


Code Block
languagebash
./controller -u [username] -p [password] -i [client ID] -v -m csv_import [PATH/TO/FILE] [profile ID] "[separation mark]" [multivalue mode]
 


Replace the placeholders of this example as follows:

...

1 The profile that is going to be used has to be created in the web interface of i-doit beforehand. The IDs of your profiles can be shown by the controller by executing it in the following way:

...


Code Block
languagebash
./controller -u [username] -p [password] -i [client ID] -v -m csv_import
 


This way the existing profiles of the client (depending on the client ID) are shown additionally to the required parameters if you have already created profiles via the user interface.

As an example, a complete execution of a CSV import looks like this:

...


Code Block
languagebash
./controller -u admin -p admin -i 1 -v -m csv_import imports/clients/client_import.csv 2 ";" row
 


According to this example, the user admin is used for login. He/she uses the password admin and logs in to the client with the ID 1. The file imports/clients/client_import.csv and the mapping profile with the ID 2 are used for the import. The separator in this file is the semicolon (;) and the list categories have been entered per row.

...