Example: Master and sales catalogs

We can insert, replace, or delete the master and sales catalog using the Data Load utility at the same time. These examples use a load file to demonstrate how to insert, replace, or delete the master and sales catalog.

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 column and XML element definitions


CSV file with sample catalog data

Insert or replace In this example, you insert four new catalog data. The file contains sample master and sales catalog data. Each column is delimited by a comma. CSV file with sample catalog data

Formatted CSV file with column headings
Identifier Name Description ShortDescription LongDescription Thumbnail FullImage MasterCatalog
Example_master_cat Example master catalog Example master catalog description Example master catalog short description Example master catalog long description master_thumb/image.jpg master_full/image.jpg true
Summer_sales_cat1 Summer sales catalog Summer sales catalog description Summer sales catalog short description Summer sales catalog long description summer_thumb/image.jpg summer_full/image.jpg false
Winter_sales_cat2 Winter sales catalog Winter sales catalog description Winter sales catalog short description Winter sales catalog long description Winter_thumb/image.jpg Winter_full/image.jpg false
Spring_sales_cat3 Spring sales catalog Spring sales catalog description Spring sales catalog short description Spring sales catalog long description Spring_thumb/image.jpg Spring_full/image.jpg false

Delete In this example, the first three rows of data are deleted, and the fourth row replaces an existing data. Each column is delimited by a comma. CSV file with sample catalog data to be deleted or replaced

Formatted CSV file with column headings
Identifier Name Description ShortDescription LongDescription Thumbnail FullImage MasterCatalog Delete
Example_master_cat Example master catalog Example master catalog description Example master catalog short description Example master catalog long description master_thumb/image.jpg master_full/image.jpg true 1
Summer_sales_cat1 Summer sales catalog Summer sales catalog description Summer sales catalog short description Summer sales catalog long description summer_thumb/image.jpg summer_full/image.jpg false 1
Winter_sales_cat2 Winter sales catalog Winter sales catalog description Winter sales catalog short description Winter sales catalog long description Winter_thumb/image.jpg Winter_full/image.jpg false 1
Spring_sales_cat3 Spring sales catalog Spring sales catalog new description Spring sales catalog new short description Spring sales catalog new long description Spring_thumb/image.jpg Spring_full/image.jpg false


Mapping data

The following code snippet from the catalog loader configuration file demonstrates how to map each value to a business object logical schema path.

If you perform an insert or replace operation, do not specify the "Delete" column in the CSV file or we can leave the "Delete" column empty.


Business object mediator

The mediator class name is CatalogMediator. To initialize attribute dictionary for the store, see Initializing the attribute dictionary.

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.