Artikel: AN0002410Aktualisiert: 20.12.2023
We can face various issues when importing data, for which we are alerted by error messages - e.g. there is not the value, in the referenced class, which we are trying to import and map to records in the referenced class, the import file does not have number of columns which is defined in the import or there is not column with the name stated in the import settings.
The last two issues are in the messages associated also with file encoding. The message says that the issue may have one of these reasons. You may think that you are importing correct data but the file has another encoding than you think.
Another issue may be separators, different count of separators in particular lines, end of line character in data etc. When checking the file do not rely on Notepad, but use rather software like PSPad Editor.
Information about encoding is not stored in the file itself. Text editors are guessing encoding according to characters used in the text. If you want to determine encoding, try to open the file using PSPad, so that you always choose a new encoding and then reopen the given file. When you see correct characters, you have selected the proper encoding.
You may find useful opening CSV file in Excel, checking that the data have correct structure, modify them if needed and save in one of following formats:
- Text (separated by tabs) (*.txt) - then import with encoding according to the setup of your Excel (e.g. 1250)
- Text in Unicode (*.txt) - then import with encoding 1200
Data correction
In some cases you can have data that are ok from the above point of view but you need to adjust them somehow. This can be performed before the import e.g. by means of CSVUtility, that converts values enumerated in a single line into more lines in order that the import file contains the same number of columns.
Example: File with server IP addresses
Before conversion:
Server1, 10.145.23.25
Server2, 10.145.23.26, 10.145.53.26, 10.192.12.189
Server3, 10.145.23.27
After conversion with CSVUtility:
Server1, 10.145.23.25
Server2, 10.145.23.26
Server2, 10.145.53.26
Server2, 10.192.12.189
Server3, 10.145.23.27
Another possibility is to correct the data during the import. Data are imported first into a temporary table in a text form in the same way they were in the input file. You can use Script after data upload into the database. Another possibility is to import first the data into an auxiliary class, then to adjust them by means of scripts and then to transfer them into the target class again with the help of scripts.
If you do not want to store text values from the file but links to a reference class, you can perform a mapping to the reference class records during the import. If one value can be expressed in the input file by several various texts, we can perform mapping of values from the file to the desired value in the link.