Example: Category calculation code

We can insert, replace, or delete the catalog group calculation code in the
CATGPCALCD database table using the Data Load utility. This example uses a CSV file to demonstrate how to insert, replace, or delete the catalog group calculation code.

This example uses a CSV file to demonstrate how to insert, replace, or delete your data. We 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 usage includes discount, shipping, sales tax, shipping tax, coupon, surcharge, and shipping adjustment. We can specify either the code or the unique id of the calculation code for each calculation usage.


CSV column and XML element definitions


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 ShippingTaxCalculationCode
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 ShippingTaxCalculationCode Delete
TV Sales Tax Shipping Tax 1


Mapping 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.

If you perform an insert or replace operation, do not specify the "Delete" column in the CSV file or we 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).

Note: When we use a mediator that is provided with WebSphere Commerce with the Data Load utility, the utility assumes that we are loading data for all columns for a business object. 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. See Configure a column exclusion list.