Example: Catalog entry calculation code

You can insert, replace, or delete your catalog entry calculation code in the CATENCALCD table by using the Data Load utility. This example uses a CSV file to demonstrate how to insert, replace, or delete your catalog entry calculation code.

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.

The calculation code table CALCODE is assumed to be already populated. There are calculation codes for different calculation usages. The provided calculation usages include 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 column and XML element definitions

PartNumber
(String) The catalog entry part number. This field cannot be null, and it must be unique. Either the PartNumber or the CatalogEntryUniqueId is required. The part number for a catalog entry displays in Management Center as the value for the catalog entry Code property.
CatalogEntryUniqueId
(BigInt) The catalog entry unique reference number. Either the PartNumber or the CatalogEntryUniqueId is required.
DiscountCalculationCode
(String) A string that uniquely identifies the CalCode for Discount.
DiscountCalculationCodeUniqueId
(Integer) An integer that uniquely identifies the CalCode for Discount.
ShippingCalculationCode
(String) A string that uniquely identifies the CalCode for Shipping.
ShippingCalculationCodeUniqueId
(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.
ShippingTaxCalculationCode
(String) A string that uniquely identifies the CalCode for Shipping Tax.
ShippingTaxCalculationCodeUniqueId
(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.
ShippingAdjustmentCalculationCode
(String) A string that uniquely identifies the CalCode for Shipping Adjustment.
ShippingAdjustmentCalculationCodeUniqueId
(Integer) An integer that uniquely identifies the CalCode for Shipping Adjustment.
Delete
(String) A flag indicating whether to delete. Specify 1 to delete the row.

CSV file with sample category description data

Insert or replace

The sample CSV file contains catalog entry sales tax and shipping tax. Sample CSV file.

Delete

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

Formatted CSV file with column headings
PartNumber SalesTaxCalculationCode ShippingTaxCalculationCode Delete
Test-PN-10001 Tax Code 1 Shipping Tax Code 1 1

Mapping data

The following snippet from the sample catalog entry calculation code loader configuration file demonstrates how to map each value to a business object logical schema path.
<_config:DataMapping>
  <_config:mapping xpath="CatalogEntryIdentifier/UniqueID" value="CatalogEntryUniqueId" />
  <_config:mapping xpath="CatalogEntryIdentifier/ExternalIdentifier/PartNumber" value="PartNumber" />
  <!-- Convention for mapping calculation code id: 
       Name is "XXXXCalculationCodeUnique" where XXXX is the calculation usage prefix. 
  -->
  <_config:mapping xpath="CatalogEntryAttributes/Attributes[1]/Name" value="DiscountCalculationCode" valueFrom="Fixed" />
  <_config:mapping xpath="CatalogEntryAttributes/Attributes[1]/IntegerValue/Value" value="DiscountCalculationCodeUniqueId" />
  <_config:mapping xpath="CatalogEntryAttributes/Attributes[1]/StringValue/Value" value="DiscountCalculationCode" />
  <_config:mapping xpath="CatalogEntryAttributes/Attributes[2]/Name" value="ShippingCalculationCode" valueFrom="Fixed" />
  <_config:mapping xpath="CatalogEntryAttributes/Attributes[2]/IntegerValue/Value" value="ShippingCalculationCodeUniqueId" />
  <_config:mapping xpath="CatalogEntryAttributes/Attributes[2]/StringValue/Value" value="ShippingCalculationCode" />
  <_config:mapping xpath="CatalogEntryAttributes/Attributes[3]/Name" value="SalesTaxCalculationCode" valueFrom="Fixed" />
  <_config:mapping xpath="CatalogEntryAttributes/Attributes[3]/IntegerValue/Value" value="SalesTaxCalculationCodeUniqueId" />
  <_config:mapping xpath="CatalogEntryAttributes/Attributes[3]/StringValue/Value" value="SalesTaxCalculationCode" />
  <_config:mapping xpath="CatalogEntryAttributes/Attributes[4]/Name" value="ShippingTaxCalculationCode" valueFrom="Fixed" />
  <_config:mapping xpath="CatalogEntryAttributes/Attributes[4]/IntegerValue/Value" value="ShippingTaxCalculationCodeUniqueId" />
  <_config:mapping xpath="CatalogEntryAttributes/Attributes[4]/StringValue/Value" value="ShippingTaxCalculationCode" />
  <_config:mapping xpath="CatalogEntryAttributes/Attributes[5]/Name" value="CouponCalculationCode" valueFrom="Fixed" />
  <_config:mapping xpath="CatalogEntryAttributes/Attributes[5]/IntegerValue/Value" value="CouponCalculationCodeUniqueId" />
  <_config:mapping xpath="CatalogEntryAttributes/Attributes[5]/StringValue/Value" value="CouponCalculationCode" />
  <_config:mapping xpath="CatalogEntryAttributes/Attributes[6]/Name" value="SurchargeCalculationCode" valueFrom="Fixed" />
  <_config:mapping xpath="CatalogEntryAttributes/Attributes[6]/IntegerValue/Value" value="SurchargeCalculationCodeUniqueId" />
  <_config:mapping xpath="CatalogEntryAttributes/Attributes[6]/StringValue/Value" value="SurchargeCalculationCode" />
  <_config:mapping xpath="CatalogEntryAttributes/Attributes[7]/Name" value="ShippingAdjustmentCalculationCode" valueFrom="Fixed" />
  <_config:mapping xpath="CatalogEntryAttributes/Attributes[7]/IntegerValue/Value" value="ShippingAdjustmentCalculationCodeUniqueId" />
  <_config:mapping xpath="CatalogEntryAttributes/Attributes[7]/StringValue/Value" value="ShippingAdjustmentCalculationCode" />
	<_config:mapping xpath="CatalogEntryAttributes/Attributes[8]/Name" value="TradingId" valueFrom="Fixed" />
  <_config:mapping xpath="CatalogEntryAttributes/Attributes[8]/StringValue/Value" value="TradingId" />
	<_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.CatalogEntryMediator for integrated load (loading catalog entry with calculation code), and com.ibm.commerce.catalog.dataload.mediator.CatalogEntryCalculationCodeMediator for separate load (loading calculation code only).

Note: When you use a mediator that is provided with WebSphere Commerce with the Data Load utility, the utility assumes that you are loading data for all columns for a business object. If you want to update the data in only specific columns, configure a column exclusion list for the load process. A column exclusion list causes the Data Load utility to ignore specific columns during the load operation. If you do not use a column exclusion list, the utility updates all columns in the row of a database table row when the utility updates the row. If no value is set in the input file, the utility can replace the existing column value with a default value or set the value to be null. For more information, see Configuring a column exclusion list.