Example: Attribute dictionary attribute values
The example shows how to insert, replace, or delete attribute values for multiple attribute dictionary 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
- Identifier
- (Mandatory, String) The unique reference name for identifying
the attribute. Either this field or the
AttributeUniqueId
is required. - AttributeUniqueId
- (Mandatory, Integer) The unique reference number of the attribute. Either this field or the Identifier is required.
- ValueIdentifier
- (String) The unique identifier of the attribute value. Use this field when the attribute includes predefined (allowed) values. If the attribute does not have predefined values that are defined, then this field is used as the value identifier of the newly created value.
- Sequence
- (Decimal) A number that is used to control the order in which attribute values display for an attribute dictionary attribute. Attribute values display in ascending order. The default value is 0.
- Value
- (String|Integer|Float) The language-specific value of the attribute. Attribute values are based on the data type such as text, number, or decimal.
- ValueUsage
- (Integer) The attribute value usage. 1 for predefined (allowed) value (for example, one of the predefined values for a color attribute is blue). If NULL then it is used for assigned attribute values (for example, the length of a product is 30. A length attribute does not have predefined values). If set to 2, the value is assigned as the default value.
- Image1
- (String) The language sensitive full image path of the attribute
value. Use the forward slash '/' in the path name. Do not use backward
slash '\'. For example,
images/G1.jpg
. - Image2
- (String) The language sensitive full image path of the attribute
value. Use the forward slash '/' in the path name. Do not use backward
slash '\'. For example,
images/G1.jpg
.
Other optional fields not included in the example:
- Language
- (Integer) The language identifier for language-sensitive fields. For example: -1 for English, -2 for French.
- LanguageId
- (Integer) The language identifier for language-specific
fields. For example:
- -1 for English
- -2 for French.
(Integer) The language ID for language-specific fields (Name, ShortDescription, LongDescription, AuxDescription1, AuxDescription2, Thumbnail, FullImage, Published, and Keyword). For instance:- -1 for English
- -2 for French.
- AttributeValueField1
- (Integer) A custom field for attribute information. (FIELD1 column of ATTRVAL table).
- AttributeValueField2
- (Integer) A custom field for attribute information. (FIELD2 column of ATTRVAL table).
- AttributeValueField3
- (String) A custom field for attribute information. (FIELD3 column of ATTRVAL table).
- Field1
- (Integer)A custom field for attribute information. (FIELD1 column of ATTRVALDESC table).
- Field2
- (String)A custom field for attribute information. (FIELD2 column of ATTRVALDESC table).
- Field3
- (String)A custom field for attribute information. (FIELD3 column of ATTRVALDESC table).
- Delete
- (String) A flag that indicates whether to delete. To delete a row, specify 1.
CSV file with sample attribute dictionary attribute values data
Insert or replaceIn this example, the CSV file contains attribute dictionary attribute values. CSV file with sample attribute dictionary attribute values.
Identifier | Type | ValueIdentifier | ValueUsage | Sequence | Value | Image1 | Image2 |
---|---|---|---|---|---|---|---|
ShirtSize | string | Shirt_Size_Large | 1 | 2 | Large | Shirt_size_large/image1.jpg | Shirt_size_large/image2.jpg |
ShirtColor | string | Shirt_Color_Red | 1 | 6 | Red | Shirt_color_red/image1.jpg | Shirt_color_red/image2.jpg |
In this example, the CSV file contains sample attribute dictionary attribute values that will be deleted. CSV file with sample attribute dictionary attribute values.
Identifier | Type | ValueIdentifier | ValueUsage | Sequence | Value | Image1 | Image2 | Delete |
---|---|---|---|---|---|---|---|---|
ShirtSize | string | Shirt_Size_Large | 1 | 2 | Large | Shirt_size_large/image1.jpg | Shirt_size_large/image2.jpg | 1 |
ShirtColor | string | Shirt_Color_Red | 1 | 6 | Red | Shirt_color_red/image1.jpg | Shirt_color_red/image2.jpg | 1 |
Mapping data
<_config:DataMapping>
<_config:mapping xpath="AttributeIdentifier/ExternalIdentifier/Identifier" value="Identifier" />
<_config:mapping xpath="AttributeIdentifier/UniqueID" value="AttributeUniqueId" />
<_config:mapping xpath="AllowedValue/language" value="Language" />
<_config:mapping xpath="AllowedValue/identifier" value="ValueIdentifier" />
<_config:mapping xpath="AllowedValue/displaySequence" value="Sequence" />
<_config:mapping xpath="AllowedValue/Value" value="Value" />
<_config:mapping xpath="AllowedValue/ExtendedValue/ValueUsage" value="ValueUsage" />
<_config:mapping xpath="AllowedValue/ExtendedValue/Image1" value="Image1" />
<_config:mapping xpath="AllowedValue/ExtendedValue/Image2" value="Image2" />
<_config:mapping xpath="AllowedValue/ExtendedValue/Field1" value="Field1" />
<_config:mapping xpath="AllowedValue/ExtendedValue/Field2" value="Field2" />
<_config:mapping xpath="AllowedValue/ExtendedValue/Field3" value="Field3" />
<_config:mapping xpath="" value="Delete" deleteValue="1" />
</_config:DataMapping>
<_config:DataMapping>
<_config:mapping xpath="AttributeIdentifier/ExternalIdentifier/Identifier" value="Identifier" />
<_config:mapping xpath="AttributeIdentifier/UniqueID" value="AttributeUniqueId" />
<_config:mapping xpath="AllowedValue/language" value="Language" />
<_config:mapping xpath="AllowedValue/language" value="LanguageId" />
<_config:mapping xpath="AllowedValue/identifier" value="ValueIdentifier" />
<_config:mapping xpath="AllowedValue/displaySequence" value="Sequence" />
<_config:mapping xpath="AllowedValue/Value" value="Value" />
<_config:mapping xpath="AllowedValue/ExtendedValue/ValueUsage" value="ValueUsage" />
<_config:mapping xpath="AllowedValue/ExtendedValue/AttributeValueField1" value="AttributeValueField1" />
<_config:mapping xpath="AllowedValue/ExtendedValue/AttributeValueField2" value="AttributeValueField2" />
<_config:mapping xpath="AllowedValue/ExtendedValue/AttributeValueField3" value="AttributeValueField3" />
<_config:mapping xpath="AllowedValue/ExtendedValue/Image1" value="Image1" />
<_config:mapping xpath="AllowedValue/ExtendedValue/Image2" value="Image2" />
<_config:mapping xpath="AllowedValue/ExtendedValue/Field1" value="Field1" />
<_config:mapping xpath="AllowedValue/ExtendedValue/Field2" value="Field2" />
<_config:mapping xpath="AllowedValue/ExtendedValue/Field3" value="Field3" />
<_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.AttributeDictionaryAttributeMediator.
If WebSphere Commerce search is enabled, use the mediator class com.ibm.commerce.catalog.dataload.mediator.AttributeDictionaryAttributeSearchIndexMediator