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


Example: Category calculation code

You can insert, replace, or delete the catalog group calculation code in the CATGPCALCD using the data load utility. This example uses a CSV file to demonstrate how to insert, replace, or delete the catalog group calculation code.

The calculation code table CALCODE is assumed to be already populated. There are calculation codes for different calculation usages. The provided calculation usage includes discount, shipping, sales tax, shipping tax, coupon, surcharge, and shipping adjustment. You can specify either the code or the unique id of the calculation code for each calculation usage.


CSV file column definitions

GroupIdentifier

(String) The category identifier. This field cannot be null, and it must be unique. Either the GroupIdentifier or the GroupUniqueId is required.

GroupUniqueId

(BigInt) The category unique reference number. Either the GroupIdentifier or the GroupUniqueId is required.

DiscountCalculationCode

(String) A string that uniquely identifies the CalCode for Discount.

DiscountCalculationCodeUniqueId

(Integer) An integer that uniquely identifies the CalCode for Discount.

ShipCalculationCode

(String) A string that uniquely identifies the CalCode for Shipping.

ShipCalculationCodeUniqueId

(Integer) An integer that uniquely identifies the CalCode for Shipping.

SalesTaxCalculationCode

(String) A string that uniquely identifies the CalCode for Sales Tax.

SalesTaxCalculationCodeUniqueId

(Integer) An integer that uniquely identifies the CalCode for Sales Tax.

ShipTaxCalculationCode

(String) A string that uniquely identifies the CalCode for Shipping Tax.

ShipTaxCalculationCodeUniqueId

(Integer) An integer that uniquely identifies the CalCode for Shipping Tax.

CouponCalculationCode

(String) A string that uniquely identifies the CalCode for Coupon.

CouponCalculationCodeUniqueId

(Integer) An integer that uniquely identifies the CalCode for Coupon.

SurchargeCalculationCode

(String) A string that uniquely identifies the CalCode for Surcharge.

SurchargeCalculationCodeUniqueId

(Integer) An integer that uniquely identifies the CalCode for Surcharge.

ShipAdjustmentCalculationCode

(String) A string that uniquely identifies the CalCode for Shipping Adjustment.

ShipAdjustmentCalculationCodeUniqueId

(Integer) An integer that uniquely identifies the CalCode for Shipping Adjustment.

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 category description data


Insert or replace

The sample CSV file contains category sales tax and shipping. Sample CSV file.

Formatted CSV file with column headings
GroupIdentifier SalesTaxCalculationCode ShipTaxCalculationCode
TV Sales Tax Shipping Tax


Delete

The sample CSV file contains category sales tax and shipping tax to be deleted from the WebSphere Commerce database. Sample CSV file.

Formatted CSV file with column headings
GroupIdentifier SalesTaxCalculationCode ShipTaxCalculationCode Delete
TV Sales Tax Shipping Tax 1


Map data

The following snippet from the sample catalog group calculation code loader configuration file demonstrates how to map each value to a business object logical schema path.

<_config:DataMapping>  
<_config:mapping xpath="CatalogGroupIdentifier/UniqueID" value="GroupUniqueId" />  
<_config:mapping xpath="CatalogGroupIdentifier/ExternalIdentifier/GroupIdentifier" value="GroupIdentifier" />  
<!-- Convention for mapping calculation code id (integer): 
       key is "XXXXCalculationCodeUniqueId" where XXXX is the calculation usage prefix
   -->     <_config:mapping xpath="Attributes/DiscountCalculationCodeUniqueId" value="DiscountCalculationCodeUniqueId" />       <_config:mapping xpath="Attributes/ShippingCalculationCodeUniqueId" value="ShippingCalculationCodeUniqueId" />       <_config:mapping xpath="Attributes/SalesTaxCalculationCodeUniqueId" value="SalesTaxCalculationCodeUniqueId" />       <_config:mapping xpath="Attributes/ShippingTaxCalculationCodeUniqueId" value="ShippingTaxCalculationCodeUniqueId" />      <_config:mapping xpath="Attributes/CouponCalculationCodeUniqueId" value="CouponCalculationCodeUniqueId" />       <_config:mapping xpath="Attributes/SurchargeCalculationCodeUniqueId" value="SurchargeCalculationCodeUniqueId" />       <_config:mapping xpath="Attributes/ShippingAdjustmentCalculationCodeUniqueId" value="ShippingAdjustmentCalculationCodeUniqueId" />  
 
<!-- Convention for mapping calculation code (string): 
       key is "XXXXCalculationCode" where XXXX is the calculation usage prefix
   -->  
<_config:mapping xpath="Attributes/DiscountCalculationCode" value="DiscountCalculationCode" />      <_config:mapping xpath="Attributes/ShippingCalculationCode" value="ShippingCalculationCode" />       <_config:mapping xpath="Attributes/SalesTaxCalculationCode" value="SalesTaxCalculationCode" />       <_config:mapping xpath="Attributes/ShippingTaxCalculationCode" value="ShippingTaxCalculationCode" />       <_config:mapping xpath="Attributes/CouponCalculationCode" value="CouponCalculationCode" />       <_config:mapping xpath="Attributes/SurchargeCalculationCode" value="SurchargeCalculationCode" />       <_config:mapping xpath="Attributes/ShippingAdjustmentCalculationCode" value="ShippingAdjustmentCalculationCode" />     <_config:mapping xpath="Attributes/TradingId" value="TradingId" />   <_config:mapping xpath="" 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 mediator class name is CatalogGroupMediator for integrated load (loading the categories with the calculation code as part of the data), and CatalogGroupCalculationCodeMediator for separate load (loading the calculation code only).


+

Search Tips   |   Advanced Search