Example: Catalog entry defining attributes
We can use the Data Load utility to insert, replace, or delete multiple defining attributes for products at the same time. Defining attributes apply to products only. SKUs, bundles, and kits cannot have defining attributes.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
- PartNumber
- (Required, String) The catalog entry identifier (product). This field is required (cannot be NULL) and it must be unique. 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 internal unique reference number of the catalog entry (product). 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 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.
- Delete
- (String) A flag indicating whether to delete. Specify 1 to delete the row.
CSV file with sample catalog entry defining attribute data
Insert or replace This file contains sample products with defining attributes. As SKUs, bundles and kits cannot have defining attributes, these catalog entry types are not included in the sample CSV file. CSV file with sample catalog entry defining attribute data. Due to the large number of fields in the CSV file, the table is split into two sections:
Formatted CSV file with column headings
PartNumber Type Name Sequence Description Example-PN-10001 String Color 1 The color of the item Example-PN-10002 String Size 2 The size of the item
Formatted CSV file with column headings - continued
SecondaryDescription GroupName Field1 Footnote Clothing A A Clothing B B
Delete This file contains sample catalog entry defining attributes that get deleted: CSV file with sample catalog entry defining attribute data.
Formatted CSV file with column headings
PartNumber Type Name Sequence Description Example-PN-10001 String Color 1 The color of the item Example-PN-10002 String Size 2 The size of the item
Formatted CSV file with column headings - continued
SecondaryDescription GroupName Field1 Footnote Delete Clothing A A 1 Clothing B B 1
Mapping data
The following code snippet from the catalog entry defining 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="Defining" 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="" 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 we can leave the "Delete" column empty.
Business object mediator
The mediator class name is CatalogEntryAttributeMediator.
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.