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


Example: Catalog entry calculation code

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

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 file column 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.

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.

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 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 ShipTaxCalculationCode Delete
Test-PN-10001 Tax Code 1 Ship Tax Code 1 1


Map 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 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 CatalogEntryMediator for integrated load (loading catalog entry with calculation code), and CatalogEntryCalculationCodeMediator for separate load (loading calculation code only).


+

Search Tips   |   Advanced Search