CSV
Another popular integration format is Comma Separated Values (CSV). CSV is convenient because it can be edited by the most popular spreadsheet programs.
Procedure 16.4. To Load Data Using CSV Files
Create an Inbound Interface
Platform uses Inbound Interfaces to consume data in Comma-separated Value (CSV) format. The Inbound Interface consists of a definition for the format of the inbound data, and a processor which should be used to write the values to the database.
Open your MPT and navigate the Outline view to Inbound Interfaces. Right-click and press "Add Inbound Interface".
For this example, we will create an Inbound Interface for loading Enterprise data. Name the interface EnterpriseLoad.
You'll notice that the interface has two tabs: Format and Processor. We use the Format tab to specify what the fields are which are present in the interface, which are required and optional, what the expected formats are for dates and numbers, etc. We use the Processor tab to specify how we get the data out of the CSV and into the database.
Next, we'll specify the Format of the interface. Click Add Fields, then click Enterprise within the list of Models.
Choose Name and Description.
Configure the Processor
Now we can specify a Processor for this simple interface. Switch to the Format tab. It should already say "Default Model CSV Processor". This means it will use Model actions to process the data.
You can specify a default custom model name and/or action in the interface itself, or these can be provided as fields within the CSV. For this example, we will provide defaults:
Now save and submit your MPT to your server. At this point, you have an Inbound Interface which you can use to load Enterprises.Test Load Using load-data Ant Target
To test, go back to the Format tab and click the Export Sample CSV button.
This will produce a sample CSV which you can populate with some test data, like the following:
Save the CSV file in data/ as EnterpriseFile.csv. We can load this CSV using the dataset's load-data target. To achieve this, add an InboundInterface entry to your LoadData.xml file:
<InboundInterfaceFile inboundInterface="ZBKS.EnterpriseLoad">data/EnterpriseFile.csv</InboundInterfaceFile>
After loading data, you should see those two Enterprises in your database: