Load values for single and multiple value attributes
We can configure the loading process for Catalog Upload and the Data Load utility to load data separately for both single and multiple value descriptive attributes. By separating these load processes, we can ensure that the values for our single value and multiple value attributes are updated accurately.
We can also use the Data Load utility to load values for attributes with assigned values and reuse the values when the same value is needed for multiple catalog entries. By sharing the assigned values across catalog entries when loading attribute assigned values, we can reduce the number of duplicate values that the utility creates in the database. See
Reuse attribute assigned values with the Data Load utility.If the site is configured to support multiple value attributes, when loading values for a descriptive attribute with Catalog Upload or the Data Load utility, we are loading multiple values. The loaded values are added to existing attribute values. The loaded values do not replace existing values. The support for loading multiple value data for attributes is controlled by the following configuration property:
<_config:property name="supportMultipleValuesForADAttributes" value="true" />
When this configuration property is set to true, any new value that you load for an attribute are inserted as multiple values for the attribute instead of replacing the existing value or values. To replace an existing value, we must include the value in your input file and set the value to be deleted by setting the value in the Delete column to be 1. For example, in the following CSV file, the value of 75 for the attribute Warranty Term is set to be deleted.
CatalogEntryAttributeDictionaryAttributeRelationship,,,,,, PartNumber,AttributeIdentifier,ValueIdentifier,Value,Usage,Sequence,Delete Product1,WARRANTY_TYPE,,Limited,Descriptive,,0 Product1,WARRANTY_TYPE,,Comprehensive,Descriptive,,0 Product1,WARRANTY_TERM,,75,Descriptive,,1 Product1,WARRANTY_TERM,,90,Descriptive,,0
If the store uses only single value attributes, we can change the setting for this property to false. This setting causes existing values to be replaced with the new values that you load. If your descriptive attributes include both multiple value and single value attributes, we can configure your load processes to change this behavior when loading data for single value attributes. With this configuration, we can load information about multiple value attributes in one input file and load information for single value attributes in a different file. This configuration ensures that when you update a value for a single value attribute, the existing value is replaced with the new value instead of adding the new value to the existing value. To configure your load process to load two separate files for our attribute value information:
- Edit the business object configuration file for our attribute value information. We must separate the single and multiple value attributes to be different load items. The setting for the supportMultipleValuesForADAttributes configuration property applies to all objects for a load item. Within each load item, we can include the supportMultipleValuesForADAttributes configuration property and set it to a different value for each load item. For example, in the default sample business object configuration file for loading attribute value information, wc-loader-catalog-entry-AD-attribute-relationship.xml, look for the following code:
<_config:LoadItem name="CatalogEntryAttributeDictionaryAttributeRelationship" businessObjectConfigFile="wc-loader-catalog-entry-AD-attribute-relationship.xml" > <_config:DataSourceLocation location="${CatalogEntryAttributeDictionaryAttributeRelationship}" /> </_config:LoadItem>This attribute value information load item can be separated into the following two load items within an edited version of the provided sample business object configuration file:
- Attribute value information load item for multiple value attributes with the supportMultipleValuesForADAttributes configuration property set to true:
<_config:LoadItem name="CatalogEntryAttributeDictionaryAttributeMultipleRelationship" businessObjectConfigFile="wc-loader-catalog-entry-AD-attribute-relationship.xml" > <_config:property name="supportMultipleValuesForADAttributes" value="true" /> <_config:DataSourceLocation location="${CatalogEntryAttributeDictionaryAttributeMultipleRelationship}" /> </_config:LoadItem>
Attribute value information load item for single value attributes with the supportMultipleValuesForADAttributes configuration property set to false: <_config:LoadItem name="CatalogEntryAttributeDictionaryAttributeSingleRelationship" businessObjectConfigFile="wc-loader-catalog-entry-AD-attribute-relationship.xml" > <_config:property name="supportMultipleValuesForADAttributes" value="false" /> <_config:DataSourceLocation location="${CatalogEntryAttributeDictionaryAttributeSingleRelationship}" /> </_config:LoadItem>
Split your input file into two separate input files. Change the keyword for our input files to match the new load item names in your business object configuration file.For example, the following CSV formatted input file contains attribute value information for both a single value attribute, WARRANTY_TERM and for a multiple value attribute, WARRANTY_TYPE: CatalogEntryAttributeDictionaryAttributeRelationship,,,,,, PartNumber,AttributeIdentifier,ValueIdentifier,Value,Usage,Sequence,Delete Product1,WARRANTY_TYPE,,Limited,Descriptive,,0 Product1,WARRANTY_TYPE,,Comprehensive,Descriptive,,0 Product1,WARRANTY_TERM,,90,Descriptive,,0Loading this file with the default sample business object configuration file results in the following changes:
- The attribute WARRANTY_TYPE having two new values, Limited, and Comprehensive, in addition to any existing values.
- The attribute WARRANTY_TERM having a value, 90, in addition to any existing values.
This input file, however, can be split into two input files and associated with different load items:
- Attribute value information input file for multiple value attributes:
CatalogEntryAttributeDictionaryAttributeMultipleRelationship,,,,,, PartNumber,AttributeIdentifier,ValueIdentifier,Value,Usage,Sequence,Delete Product1,WARRANTY_TYPE,,Limited,Descriptive,,0 Product1,WARRANTY_TYPE,,Comprehensive,Descriptive,,0Loading this file results in the attribute WARRANTY_TYPE having two new values, Limited, and Comprehensive, in addition to any existing values.
Attribute value information input file for single value attributes: CatalogEntryAttributeDictionaryAttributeSingleRelationship,,,,,, PartNumber,AttributeIdentifier,ValueIdentifier,Value,Usage,Sequence,Delete Product1,WARRANTY_TERM,,90,Descriptive,,0Loading this file results in the attribute WARRANTY_TERM having any existing values that are replaced with the new value 90.