Samples > Data load utility samples > Examples: Mapping data > Examples: Mapping catalog data > Examples: Mapping catalog entry data
Example: Attribute dictionary attributes and allowed values
Use the data load utility to insert, replace, and delete multiple attribute dictionary attributes and allowed values simultaneously.
CSV file column definitions
- Identifier
- (Mandatory, String) The attribute identifier. This field is mandatory (cannot be NULL) in Insert and it must be unique. In Replace or Delete, either this field or the AttributeUniqueId is mandatory.
- AttributeUniqueId
- (BigInt) The internal unique reference number of the attribute. In Replace or Delete, either this field or the Identifier is mandatory.
- Type
- (String) This field defines the data type of the attribute. This field cannot be NULL. Examples of data types are STRING, INTEGER, and FLOAT.
- Name
- (String) The name of this attribute. This field is language sensitive.
- Description
- (String) A description of this attribute. This field is language sensitive.
- SecondaryDescription
- (String) 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 user defined field available for customization purposes.
- Footnote
- (String) Use this field to store auxiliary attribute data such as a footnote.
- UnitOfMeasure
- (String) The unit in which this attribute is measured.
- Value1
- (String|Integer|Float) An allowed value of the attribute.
- Value2
- (String|Integer|Float) An allowed value of the attribute.
- Value3
- (String|Integer|Float) An allowed value of the attribute.
- 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.
CSV file with sample attribute dictionary data
In this example, the CSV file contains attribute dictionary data. CSV file with sample attribute dictionary data. Due to the large amount of fields in the CSV file, the table has been split into 3 sections:
Formatted CSV file with column headings
Identifier Type Name Description ShirtSize string Shirt Size The size of the shirt ShirtColor string Shirt Color The color of the shirt
Formatted CSV file with column headings - continued
SecondaryDescription GroupName Field1 Footnote "Small, medium, or large" Clothing_Shirts AA "red, green, or blue" Clothing_Shirts BB
Formatted CSV file with column headings - continued
UnitOfMeasure Value1 Value2 Value3 Small Medium Large Red Green Blue
Map data
The following code snippet from the catalog entry attribute and allowed values load configuration file demonstrates how to map each value to a business object logical schema path. This example shows up to 3 allowed values per attribute.
<_config:DataMapping> <_config:mapping xpath="AttributeIdentifier/ExternalIdentifier/Identifier" value="Identifier" valueFrom="InputData"/> <_config:mapping xpath="AttributeIdentifier/UniqueID" value="AttributeUniqueId" valueFrom="InputData"/> <_config:mapping xpath="AttributeDataType" value="Type" valueFrom="InputData" /> <_config:mapping xpath="Name" value="Name" valueFrom="InputData" /> <_config:mapping xpath="Description" value="Description" valueFrom="InputData" /> <_config:mapping xpath="ExtendedData/SecondaryDescription" value="SecondaryDescription" valueFrom="InputData" /> <_config:mapping xpath="ExtendedData/DisplayGroupName" value="GroupName" valueFrom="InputData" /> <_config:mapping xpath="ExtendedData/Field1" value="Field1" valueFrom="InputData" /> <_config:mapping xpath="ExtendedData/Footnote" value="Footnote" valueFrom="InputData" /> <_config:mapping xpath="ExtendedData/UnitOfMeasure" value="UnitOfMeasure" valueFrom="InputData" /> <_config:mapping xpath="AllowedValue[0]/identifier" value="Value1" valueFrom="InputData" /> <_config:mapping xpath="AllowedValue[0]/displaySequence" value="1.0" valueFrom="Fixed" /> <_config:mapping xpath="AllowedValue[0]/Value" value="Value1" valueFrom="InputData" /> <_config:mapping xpath="AllowedValue[0]/ExtendedValue/ValueUsage" value="1" valueFrom="Fixed" /> <_config:mapping xpath="AllowedValue[1]/identifier" value="Value2" valueFrom="InputData" /> <_config:mapping xpath="AllowedValue[1]/displaySequence" value="2.0" valueFrom="Fixed" /> <_config:mapping xpath="AllowedValue[1]/Value" value="Value2" valueFrom="InputData" /> <_config:mapping xpath="AllowedValue[1]/ExtendedValue/ValueUsage" value="1" valueFrom="Fixed" /> <_config:mapping xpath="AllowedValue[2]/identifier" value="Value3" valueFrom="InputData" /> <_config:mapping xpath="AllowedValue[2]/displaySequence" value="3.0" valueFrom="Fixed" /> <_config:mapping xpath="AllowedValue[2]/Value" value="Value3" valueFrom="InputData" /> <_config:mapping xpath="AllowedValue[2]/ExtendedValue/ValueUsage" value="1" valueFrom="Fixed" /> <_config:mapping xpath="" value="Delete" deleteValue="1"/> </_config:DataMapping>If more values are desired, repeat these lines for each value and increment the value number and so on:
<_config:mapping xpath="AllowedValue[3]/identifier" value="Value4" valueFrom="InputData" /> <_config:mapping xpath="AllowedValue[3]/displaySequence" value="4.0" valueFrom="Fixed" /> <_config:mapping xpath="AllowedValue[3]/Value" value="Value4" valueFrom="InputData" /> <_config:mapping xpath="AllowedValue[3]/ExtendedValue/ValueUsage" value="1" valueFrom="Fixed" />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 data load framework provides a business object mediator for inserting, replacing, and deleting attribute dictionary attributes and allowed values. The mediator class name is AttributeDictionaryAttributeMediator.