Example CSV file data source

For example suppose we want to create a mapping from a CSV text file of the following format, to a database. Our first task is to define the source of the transfer, the second is to create an appropriate target data source, and lastly we will define the mappings between the two

Step 1: Defining the Source of our data transfer:

The CSV file contains details of orders, with the headings in the first line, for example:

Customer,OrderNum,ProductCode,Qty,Price,UOM,ETA
ABC100,12335,WP100,10,5.95,EACH,20020901
XYZ200,12336,WP100,2,5.95,EACH,20020901
XYZ200,12336,WP200,4,6.95,EACH,20020901
GGG984,414412,WP990,3,19.99,EACH,20020901
GGG984,414412,WP991,3,29.99,EACH,20020902
GGG984,414412,WP100,6,5.95,EACH,20020902

This text file, which we call New, has three different orders in it, the first with one line, the second with two, and the third with three lines.

To set this up as a data source in our project, we would select the CSV node in Explorer, then use the option New CSV file from the right-click menu or use the New Action icon on the toolbar, see New action for more. Set up the Properties tab for this data source. For example we might set up a CSV data source properties panel as follows:

Pressing the View Data tab lets us view the file, since we have identified the path in the File delivery section of the Properties window, for example we would see:

The Definition tab is where we must indicate the structure of the data source which is to be the source of our Data transfer, i.e. we must identify the entities and fields. In this case select the Data Source Definition line and use the New entity icon to see the Entity properties window. When you have named the entity, in this example we name it New, it will appear in the Definition tab. Select the Entity, right-click and choose New field to see Field properties.  Successively creating new fields in this way allows you to build up a definition appropriate to this CSV file:

The next step is to create the target for the data transfer, see Example JDBC target. To see an example of a more structured data source, with relationships defined, see Example XML definition.

Related topics include Example JDBC target, Example JDBC mapping