Samples > Data load utility samples > Examples: Mapping data > Examples: Mapping catalog data > Examples: Mapping catalog entry data
Example: Catalog entry defining attribute allowed values
You can use the data load utility to insert, replace, or delete allowed values for defining attributes at the product level. These examples uses a CSV file to demonstrate how to insert, replace, or delete allowed values for defining attributes. You might enter multiple allowed values for each attribute at the same time.
CSV file column definitions
- PartNumber
- (Mandatory, String) The catalog entry identifier (product). Either this field or the CatalogEntryUniqueId is mandatory.
- CatalogEntryUniqueId
- (Mandatory, BigInt) The internal unique reference number of the catalog entry (product). Either this field or the PartNumber is mandatory.
- Name
- (String) The name of this attribute. This field is language sensitive.
- ValueSequence
- (Double) A sequence number used to control the order in which attribute values are displayed in an attribute. This value cannot be NULL. The default value = 0.
- Value
- (String|Integer|Float)) The value of the attribute.
- Image1
- (String) The path of the first image of this attribute. This field is language sensitive.
- Image2
- (String) The path of the second image of this attribute. This field is language sensitive.
- AttachmentID
- (BigInt) The reference number of an attachment that is associated with the attribute value.
- Delete
- (String) Indicates whether to delete. If you are performing a delete operation, specify this column. A value of "1", indicates that the row should be deleted.
Other optional fields not included in the example are:
- ValueField1
- (Integer) A user defined attribute value field available for customization purposes.
- ValueField2
- (String) A user defined attribute value field available for customization purposes.
- ValueField3
- (String) A user defined attribute value field available for customization purposes.
CSV file with sample catalog entry defining attribute data
Insert or replaceIn this example, the CSV file contains sample allowed values for defining attributes. CSV file with sample defining attribute allowed values. Due to the large amount of fields in the CSV file, the table has been split into 2 sections:
Formatted CSV file with column headings
PartNumber Name ValueSequence Value Example-PN-10001 Color 1 Red Example-PN-10001 Color 2 Blue Example-PN-10002 Size 3 Large Example-PN-10002 Size 4 Small
Formatted CSV file with column headings - continued
Image1 Image2 AttachmentID Red1/image.jpg Red2/image.jpg 1221 Blue1/image.jpg Blue2/image.jpg Large1/image.jpg Large2/image.jpg 1222 Small1/image.jpg Small2/image.jpg
DeleteIn this example, the CSV file contains sample allowed values for defining attributes that will be deleted. CSV file with sample defining attribute allowed values. Due to the large amount of fields in the CSV file, the table has been split into 2 sections:
Formatted CSV file with column headings
PartNumber Name ValueSequence Value Example-PN-10001 Color 1 Red Example-PN-10001 Color 2 Blue Example-PN-10002 Size 3 Large Example-PN-10002 Size 4 Small
Formatted CSV file with column headings - continued
Image1 Image2 UnitOfMeasure AttachmentID Delete Red1/image.jpg Red2/image.jpg 1221 1 Blue1/image.jpg Blue2/image.jpg 1 Large1/image.jpg Large2/image.jpg 1222 1 Small1/image.jpg Small2/image.jpg 1
Map data
The following code snippet from the catalog entry defining attribute allowed 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]/AllowedValue/displaySequence" value="ValueSequence" 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 are performing 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 CatalogEntryAttributeMediator.