|
Importing data from CSV file |
|
|
|
|
The CSV import function allows you to import data from delimited text files into Inventory's tables.
Different from other Inventory screens this functionality was built as a "Wizard", which takes
the user through a series of sequential steps that will be explain below.
CSV Import functionality was introduced in Inventory version 0.82
- Step #1: Uploading a CSV file
- When starting the process, you are presented with the first step of the wizard.
You can restart the wizard at any stage by clicking the "CSV Import Wizard"
icon in the top toolbar).
This stage requires you to upload your CSV file to the server. Note that only textual
files ending with .csv or .txt will be accepted. Click the "Browse" button and use the
file browse dialog to locate the CSV file on your local computer and select it. Once the file
appears in the edit box, click the "Send File" button to send the CSV file to the server.
If you're experiencing
trouble with the upload process, check the config file
and see that the 'tmpDir' parameter is set to a directory where the server can write files to.
- Step #2: Preview the CSV File
-
Once the file is uploaded to the server, you'll be presented with a preview of the file (first few lines).
In this stage you can verify that the file is parsed correctly, and change parsing parameters if needed:
- You may want to change the "Field Delimiter" to a character other than a comma (,)
- You may also want to specify if the first row in the file is a header row or not
Once you've changed any of these parameters, click the "Refresh" button to re-parse the CSV file
according to the new settings. You may repeat this process until the file is parsed correctly, and displayed
in the preview table like it should.
Once the file preview is OK, click the "Next" button to proceed to the next step.
The file preview table will keep
showing in the next steps, so you can reference it in these steps.
- Step #3: Choosing an Inventory table
-
This step lets you choose which Inventory table you'd like to import data to. Select the table from the list,
and click "Next" to proceed.
- Step #4: Associating CSV data with the Table
-
This step will allow you to assign which column in the CSV file will go to which field/column in the Inventory
table you've chosen in step #3.
It is recommended that you have a good
familiarity with the structure of Inventory's tables so
you can associate data to it's proper place.
This stage presents you with a table where each row refers to one column in the Inventory table you've chosen.
Table field names are presented in the leftmost column labeled "Table Column Name".
You need to decide what value you'd like to assign to each column, by changing the values on it's row:
select from the adjacent listbox which action you'd like to take:
- You can ignore this column by using "Do not assign value" option. in this case the column will
not be referred to in the SQL statement, and will receive its default value. (This is recommended for fields you
are not sure of, or auto_increment fields - like the id field common in many tables).
- You can assign a NULL value to this column.
- You can assign a specific value to this column. You can specify that value using the "Set Value"
editbox present on that row.
- Or, you can assign data from the CSV file, by specifying which column to associate with this field.
Note that when using "First row is a header" option, CSV column names will use the header
row values - and when this option is not set, the column names will be designated by number.
Once you've set all column associations as desired, click the "Finish" button to import the data into
Inventory.
- Step #5: Data Insertion
- This step inserts the CSV data into Inventory, and presents you with a report of this operation:
- First you are presented with statistics on how many INSERT operations succeeded and how many failed.
- If the operation is successful (no errors), the uploaded CSV is silently deleted from the server.
- If there are failures, you are presented with more information so you can understand what went wrong:
- If there are failures, the CSV file is not deleted from the server so you
can go back and redo previous stages. Thus, you are presented with a link allowing you to delete the
file from the server
- You are also presented with the last error message generated by the SQL database
- and last, you are presented with the CSV rows that generated the errors, you may wish
to copy them and paste into a new file, for later use.
This is the final step in the process, and success means that data was inserted into the Inventory database. If
you have more CSV files to import, use the top toolbar to restart the import process with a new file.
|
Importing data from CSV file |
|
|
|
|