Example: Catalog entry defining attribute values

You can use the Data Load utility to insert, replace, or delete insert and replace the values of defining attributes at the SKU-level. You might load only one value per attribute. These examples use a CSV file to demonstrate how to insert, replace, or delete the values of defining attributes.

This example uses a CSV file to demonstrate how to insert, replace, or delete your data. You 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

PartNumber
(Required, String) The catalog entry identifier (SKU). Either this field or the CatalogEntryUniqueId is required.
CatalogEntryUniqueId
(Required, BigInt) The internal unique reference number of the catalog entry (SKU). Either this field or the PartNumber is required.
Name
(String) The name of this attribute. This field is language sensitive.
Value
(String|Integer|Float) The value of the attribute.
Delete
(String) A flag indicating whether to delete. Specify 1 to delete the row.

CSV file with sample defining attribute values

Insert or replace

In this example, the CSV file contains sample values for defining attributes. Each column is delimited by a comma. CSV file with sample defining attribute values.
Formatted CSV file with column headings
PartNumber Name Value
Example-PN-10001 Color Red
Example-PN-10002 Size Large

Delete

In this example, the CSV file contains sample values for defining attributes that get deleted. CSV file with sample defining attribute values.

Formatted CSV file with column headings
PartNumber Name Value Delete
Example-PN-10001 Color Red 1
Example-PN-10002 Size Large 1

Mapping data

The following code snippet from the catalog entry defining attribute values loader configuration file demonstrates how to map each value to a business object logical schema path.
<_config:DataMapping>
	<_config:mapping xpath="CatalogEntryIdentifier/ExternalIdentifier/PartNumber" value="PartNumber" valueFrom="InputData"/>
	<_config:mapping xpath="CatalogEntryIdentifier/UniqueID" value="CatalogEntryUniqueId" valueFrom="InputData"/>
	<_config:mapping xpath="CatalogEntryAttributes/Attributes[0]/AttributeIdentifier/UniqueID" value="AttributeUniqueId" valueFrom="InputData"/>
	<_config:mapping xpath="CatalogEntryAttributes/Attributes[0]/Name" value="Name" valueFrom="InputData" />
	<_config:mapping xpath="CatalogEntryAttributes/Attributes[0]/Value/value" value="Value" valueFrom="InputData" />
	<_config:mapping xpath="" value="Delete" deleteValue="1"/>
</_config:DataMapping> 
If you perform an insert or replace operation, do not specify the "Delete" column in the CSV file or you can leave the "Delete" column empty.

Business object mediator

The mediator class name is com.ibm.commerce.catalog.dataload.mediator.CatalogEntryAttributeMediator.

Note: When you use a mediator that is provided with HCL Commerce with the Data Load utility, the utility assumes that you are loading data for all columns for a business object. If you want 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. For more information, see Configuring a column exclusion list.