Example: Inserting and replacing receipts

We can insert or replace your expected receipts using the Data Load utility. These examples use a CSV file to demonstrate how to insert or replace your expected receipt data.

This example uses a CSV file to demonstrate how to insert, replace, or delete your data. We can also create and use an XML formatted file to insert, replace, or delete your data. If you choose to create and use an XML formatted file, ensure that your XML elements use the same names as are used for CSV column names.

Use the Data Load utility to load receipts data into the RECEIPT table.


Prerequisites

Before you run this example, ensure that the following prerequisites are fulfilled:


CSV file with sample receipt data

In this example, the data source is a CSV file named Receipt.csv. The file contains sample receipt data. Each column is delimited by a comma.

PartNumber CreateTime ReceiptDate Quantity Cost Currency VendorName Comment1 Comment2 CatEntryStoreIdentifier
Example-PN-10002 2005-07-12 01:01:01.123456 2004-03-08 00:00:00.0 10000 100 USD MyCompany comment 1 comment 2 10701
Example-PN-10003 2008-05-15 04:04:04.0 2008-12-24 09:02:00.0 2045 20 CNY


CSV column and XML element definitions

Other optional fields not included in the example:


Business context data

The following code snippet from the wc-dataload-env.XML configuration file provides the business context data necessary for loading the receipt data:


Mapping data

The following snippet from the sample configuration file demonstrates how to map each column of data in the source CSV file to a value.

The following snippet from the sample configuration file demonstrates how to map each column of the data in the CSV file to a business object logical schema path. The attribute 'value' represents the name of a column of the CSV file, which is defined in the configuration snippet. Each column in the CSV file must have a mapping to the logical schema path. If the optional fields specified are present in the CSV file, the mapping for them must be added. The mapping logical schema path is specified in the following table.


Business object mediator

The mediator class name is com.ibm.commerce.inventory.dataload.mediator.InventoryReceiptMediator. The corresponding logical schema is InventoryReceipt.xsd.

Note: When we use a mediator that is provided with WebSphere Commerce with the Data Load utility, the utility assumes that we are loading data for all columns for a business object. To update the data in only specific columns, configure a column exclusion list for the load process. A column exclusion list causes the Data Load utility to ignore specific columns during the load operation. If you do not use a column exclusion list, the utility updates all columns in the row of a database table row when the utility updates the row. If no value is set in the input file, the utility can replace the existing column value with a default value or set the value to be null. See Configure a column exclusion list.