Example: Catalog entry descriptive attributes and attribute values

You can insert, replace, or delete descriptive attributes and attribute values data by using the Data Load utility. These examples use a CSV file to demonstrate how to insert, replace, or delete your descriptive attributes and attribute values data.

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 (product or SKU). Either this field or the CatalogEntryUniqueId is required. The part number for a catalog entry displays in Management Center as the value for the catalog entry Code property.
CatalogEntryUniqueId
(Required, BigInt) The unique reference number of the catalog entry (product or SKU). Either this field or the PartNumber is required.
Type
(String) The data type of the attribute, such as string, integer, or float. This filed is required and cannot be NULL.
Name
(String) The name of this attribute. This field is language sensitive.
Sequence
(Double) A sequence number that is used to control the order in which attributes are displayed in a product. This value cannot be NULL. The default value = 0.
Description
(String) A description of this attribute. This field is language sensitive.
SecondaryDescription
(String) A secondary description of this attribute. This field is language sensitive.
GroupName
(String) The name of the attribute group this attribute belongs to.
Field1
(String) A customizable field for this attribute.
Footnote
(String) Additional attribute data such as a footnote.
ValueName
(String) The name of this attribute value. This field is language sensitive.
Value
(String|Integer|Float) The value of the attribute.
Image1
(String) The path of the first image of the attribute. This field is language sensitive. The forward slash '/' must be used in the path. Do not use backward slash '\'. For example, images/G1.jpg.
Image2
(String) The path of the second image of the attribute. This field is language sensitive. The forward slash '/' must be used in the path. Do not use backward slash '\'. For example, images/G1.jpg.
Delete
(String) A flag indicating whether to delete. Specify 1 to delete the row.

Other optional fields not included in the example are:

ValueField1
(Integer) A customizable field for this attribute.
ValueField2
(String) A customizable field for this attribute.
ValueField3
(String) A customizable field for this attribute.
UnitOfMeasure
(String) The unit in which this attribute value is measured.
AttachmentID
(Integer) The reference number of an attachment that is associated with the attribute value.

CSV file with sample catalog entry descriptive attribute data

Insert or replace

In this example, the CSV file contains sample catalog entry descriptive attribute and attribute value data: CSV file with sample catalog entry descriptive attribute data. The formatted CSV file, which is divided into three sections, is shown in the following tables:

Formatted CSV file with column headings
PartNumber Type Name Sequence Description
Example-PN-10001 String WashMethod 1 Wash method
Example-PN-10002 String WashMethod 2 Wash method
Formatted CSV file with column headings - continued
SecondaryDescription GroupName Field1 Footnote
Clothing A A
Clothing B B
Formatted CSV file with column headings - continued
ValueName Value Image1 Image2
dryCleanOnly Dry clean only dry_clean_1/image.jpg dry_clean_2/image.jpg
handWashable Hand Washable handwash_thumb1/image.jpg handwash_thumb2/image.jpg

Delete

In this example, the CSV file contains sample catalog entry descriptive attribute and attribute value data to delete. CSV file with sample catalog entry descriptive attribute data.

Formatted CSV file with column headings
PartNumber Type Name Sequence Description
Example-PN-10001 String WashMethod 1 Wash method
Example-PN-10002 String WashMethod 2 Wash method
Formatted CSV file with column headings - continued
SecondaryDescription GroupName Field1 Footnote
Clothing A A
Clothing B B
Formatted CSV file with column headings - continued
ValueName Value Image1 Image2 Delete
dryCleanOnly Dry clean only dry_clean_1/image.jpg dry_clean_2/image.jpg 1
handWashable Hand Washable handwash_thumb1/image.jpg handwash_thumb2/image.jpg 1

Mapping data

The following code snippet from the catalog entry descriptive attributes 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]/AttributeDataType" value="Type" valueFrom="InputData" />
	<_config:mapping xpath="CatalogEntryAttributes/Attributes[0]/Name" value="Name" valueFrom="InputData" />
	<_config:mapping xpath="CatalogEntryAttributes/Attributes[0]/usage" value="Descriptive" valueFrom="Fixed" />
	<_config:mapping xpath="CatalogEntryAttributes/Attributes[0]/displaySequence" value="Sequence" valueFrom="InputData" />
	<_config:mapping xpath="CatalogEntryAttributes/Attributes[0]/Description" value="Description" valueFrom="InputData" />
	<_config:mapping xpath="CatalogEntryAttributes/Attributes[0]/ExtendedData/SecondaryDescription" value="SecondaryDescription" valueFrom="InputData" />
	<_config:mapping xpath="CatalogEntryAttributes/Attributes[0]/ExtendedData/DisplayGroupName" value="GroupName" valueFrom="InputData" />
	<_config:mapping xpath="CatalogEntryAttributes/Attributes[0]/ExtendedData/Field1" value="Field1" valueFrom="InputData" />
	<_config:mapping xpath="CatalogEntryAttributes/Attributes[0]/ExtendedData/Footnote" value="Footnote" valueFrom="InputData" />
	<_config:mapping xpath="CatalogEntryAttributes/Attributes[0]/ExtendedData/UnitOfMeasure" value="UnitOfMeasure" valueFrom="InputData" />
	<_config:mapping xpath="CatalogEntryAttributes/Attributes[0]/AllowedValue/identifier" value="Value" valueFrom="InputData" />
	<_config:mapping xpath="CatalogEntryAttributes/Attributes[0]/AllowedValue/Value" value="Value" valueFrom="InputData" />
	<_config:mapping xpath="CatalogEntryAttributes/Attributes[0]/AllowedValue/ExtendedValue/Image1" value="Image1" valueFrom="InputData"/>
	<_config:mapping xpath="CatalogEntryAttributes/Attributes[0]/AllowedValue/ExtendedValue/Image2" value="Image2" valueFrom="InputData" />
	<_config:mapping xpath="CatalogEntryAttributes/Attributes[0]/AllowedValue/ExtendedValue/Field1" value="ValueField1" valueFrom="InputData" />
	<_config:mapping xpath="CatalogEntryAttributes/Attributes[0]/AllowedValue/ExtendedValue/Field2" value="ValueField2" valueFrom="InputData" />
	<_config:mapping xpath="CatalogEntryAttributes/Attributes[0]/AllowedValue/ExtendedValue/Field3" value="ValueField3" valueFrom="InputData" />
	<_config:mapping xpath="CatalogEntryAttributes/Attributes[0]/AllowedValue/ExtendedValue/AttachmentID" value="AttachmentID" valueFrom="InputData" />
	<_config:mapping xpath="" value="Delete" valueFrom="InputData" 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 WebSphere 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.