Pages

Showing posts with label CSV Import. Show all posts
Showing posts with label CSV Import. Show all posts

Friday, March 22, 2013

CSV Import Using CSVUTIL utility


In my previous post, we've seen how to import an individual CSV to insert/update/delete records of one table. But when we need to upload data into several tables and doing it one by one can be very very time consuming. Luckily, OTM gives us an utility with which we can import more than one CSV file.

Let’s take a scenario of creating a CONTACT and assign it to an existing contact group.

1. Prepare a CSV file for CONTACT Table

2. Prepare a CSV for CONTACT_GROUP Table

3. Open a notepad and write the below commands

-dataFileName CONTACT.CSV -command i
-dataFileName CONTACT_GROUP.CSV -command i

4. Save the file as csvutil.ctl
List the CSV files in the order they should be uploaded.
In this case, first Contact needs to be created & then assigned to a group.
5. Create a zip file with 3 files (CONTACT.CSV, CONTACT_GROUP.CSV, csvutil.ctl)

6. Navigate to Business Process Automation -> Integration -> Integration manager -> Upload a CSV/XML Transmission

7. Upload the zip file
8. If there are no errors OTM returns a log file.

Monday, October 22, 2012

Importing CSV files into OTM

OTM requires lot of data to model your business. During Implementation, you may require to import lot of static data like
-> Locations
-> Service Providers
-> Items
-> Contacts, etc

Instead of entering manually on OTM web pages, importing static data in CSV format is a better option. Because with CSV you can import large amounts of data very quickly.


Important Note: 

1. When you import the data via CSV, OTM inserts it directly into the database without calling any events or setting any statuses.
2. Also OTM changes the data into UPPER case , where as this doesn't happen during the data via integration.
3. Use a text editor or Ms-excel with extreme care. 
4. Try to skip optional columns.

Format of the CSV file:

1. First line of the file must state the table name in which the data goes to.
2. Second line must contain the list of column names separated with a comma
3. Third line may contain a SQL command to execture. [Eg: Alter session]
4. Fourth Line onwards, it should be data which is to be inserted into the table.

Example of Location CSV:


Data Import Order

A single CSV file can load the data of only one table. Hence, you must first load the data of master tables and then the child tables which use foreign keys.

Steps to Import

1. Navigate to Business Process Automation -> Integration -> Integration Manager
2. Select 'Upload an XML/CSV Transmission'
3. Click on browser and select the csv file which needs to be uploaded.
4. Choose one of the below command and click on Run button
i - insert CSV data into database
u - update the data in the database
d - delete the data from database
ii,uu,dd - suppressing error messages for corresponding commands and continue with next record.
iu - attempts to insert the data. If record exists, updates the data.
5. Make Sure that the error count is 0 and the process count is the number of records you are expecting. 




.