Samples > Data load utility samples > Examples: Mapping data > Examples: Mapping catalog data > Examples: Mapping catalog entry data


Example: Attribute dictionary attributes

You can use the data load utility to insert, replace, or delete multiple attribute dictionary attributes. These examples uses a CSV file to demonstrate how to insert, replace, or delete multiple attribute dictionary attributes 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

(Mandatory, 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.

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 attribute data


Insert or replace

In this example, the CSV file sample contains attribute dictionary data. CSV file with sample attribute dictionary data.

Formatted CSV file with column headings
Identifier Type Name Description SecondaryDescription
ShirtSize string Shirt Size The size of the shirt "Small, medium, or large"
ShirtColor string Shirt Color The color of the shirt "red, green, or blue"

Formatted CSV file with column headings - continued
GroupName Field1 Footnote UnitOfMeasure
Clothing_Shirts AA    
Clothing_Shirts BB    


Delete

In this example, the CSV file contains sample attribute dictionary data to delete. CSV file with sample attribute dictionary data. 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
Identifier Type Name Description SecondaryDescription
ShirtSize string Shirt Size The size of the shirt "Small, medium, or large"
ShirtColor string Shirt Color The color of the shirt "red, green, or blue"

Formatted CSV file with column headings - continued
GroupName Field1 Footnote UnitOfMeasure Delete
Clothing_Shirts AA     1
Clothing_Shirts BB     1


Map data

The following code snippet from the attribute dictionary attributes loader configuration file demonstrates how to map each value to a business object logical schema path.

<_config:DataMapping>     <_config:mapping xpath="AttributeIdentifier/ExternalIdentifier/Identifier" value="Identifier"/>     <_config:mapping xpath="AttributeIdentifier/UniqueID" value="AttributeUniqueId"/>     <_config:mapping xpath="AttributeDataType" value="Type" />     <_config:mapping xpath="Name" value="Name" />     <_config:mapping xpath="Description" value="Description" />     <_config:mapping xpath="ExtendedData/SecondaryDescription" value="SecondaryDescription" />     <_config:mapping xpath="ExtendedData/DisplayGroupName" value="GroupName" />     <_config:mapping xpath="ExtendedData/Field1" value="Field1" />     <_config:mapping xpath="ExtendedData/Footnote" value="Footnote" />     <_config:mapping xpath="ExtendedData/UnitOfMeasure" value="UnitOfMeasure" />     <_config:mapping xpath="" valueFrom="InputData" value="Delete" 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 data load framework provides a business object mediator for inserting and replacing catalog entries. The mediator class name is AttributeDictionaryAttributeMediator.


+

Search Tips   |   Advanced Search