Number usage

Number usage defines the way a number is used in an application. For example, by using number usage codes in your HCL Commerce code, you can choose the way that you would like that number (currency or quantity) to be formatted and rounded. These codes (defined in the NUMBRUSG table) allow the number to be formatted according to the rules that you specify in the CURFORMAT, CURFMTDESC, QTYFORMAT and QTYFMTDESC tables. This allows stores to format numbers in different ways to meet a variety of requirements.

Each row in the NUMBRUSG table contains a record for a certain type of number usage. These are the pre-defined number usages that are allowed in the NUMBRUSG table:

  • com.ibm.commerce.default Used when there is no record for another number usage, or when a number usage is not specified on any of the currency or quantity formatting beans or the currency or quantity manager API. com.ibm.commerce.unitPrice Used for formatting unit prices retrieved from an offer (see OFFER and OFFERPRICE tables). This number usage is used to round unit prices in the ORDERITEMS table and product prices on display pages.
  • com.ibm.commerce.listPrice Used for formatting list prices retrieved from the LISTPRICE table.

These entries should not be changed. All formatting records in the CURFORMAT, CURFMTDESC, QTYFORMAT and QTYFMTDESC tables specify the default number usage for formatting unit prices and list prices. To have HCL Commerce format unit prices or list prices differently, you must add rows to the CURFORMAT table for the appropriate number usages.

When your application uses the CurrencyManager or QuantityManager to round or format amounts, you can specify the appropriate number usage code in the CODE column of the NUMBRUSG table. The CurrencyManager or QuantityManager uses the formatting rule for the specified number usage, if it exists.

Note: When you create a row in the NUMBRUSG, CURFORMAT, or QTYFORMAT table, you must also create a row in the NUMBRUSGDS, QTYFMTDESC, or QTYFMTDESC table for each supported language.