Example: Inserting and replacing price lists

The Data Load utility provides two modes for loading price lists: insert and replace. Use the insert modes for new price lists. Use the replace mode to update an existing price list.

Do not use the insert mode if a price list with the same price list name, or if a uniqueId exists in database. In the replace mode, if the price list name or the uniqueId in the load file does not exist in database, the price list is not replaced. In insert mode, if a price list with the same price list name or uniqueId exists in database, the record is not inserted. In replace mode, if a price list in the load file does not exist in database, the price list is inserted.

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.


CSV file with sample price list data

The example CSV file, PriceListGroup.csv contains sample price list data. The first row in the CSV file can also be column names, which depend on the firstLineIsHeader attribute in the price list data load configuration file. The firstLineIsHeader is an attribute of <_config:DataReader> element.

Formatted CSV file with column headings
Name Description Precedence Type
Standard Price List This list is the standard price list. 1 S
Holiday price list This is the price list for the holiday. 5 C
Legacy system price list This is the price list that is managed by the legacy system. 2 E
Overstock price list This is the price list for overstocked items. 1 C


CSV column and XML element definitions

The column order is defined in the price list data load configuration file. See the number attribute in the <_config:Data> element.


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. Figure 1. Mapping data with uniqueID

The number attribute in the <_config:column> element, defines the column order in the CSV record file. The name attribute defines the column name used in the <_config:DataMapping> element.

The following snippet maps each value to a business object logical schema path.

The value attribute in the <_config:DataMapping> element must be consistent with the name attribute of the corresponding item in the <_config:column> element. Both attributes are case-sensitive. Figure 2. Mapping data without a uniqueID

The number attribute in the <_config:column> element, defines the column order in the CSV record file. The name attribute defines the column name used in the <_config:DataMapping> element.

The following snippet maps each value to a business object logical schema path.

The value attribute in the <_config:DataMapping> element must be consistent with the name attribute of the corresponding item in the <_config:column> element. Both attributes are case-sensitive.


Business object mediator

The mediator class name is com.ibm.commerce.price.dataload.mediator.PriceRuleMediator. The corresponding logical schema is PriceRule.xsd. The component ID is com.ibm.commerce.price.

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.