Rounding Invoice Report Data

A common problem observed at several client sites has been rounding numbers on the invoice report. The XML numeric data type causes problems in Crystal Reports and has to be converted to a CDbl() data type. For example, if you add a numeric XML field from the XSD to the report and sum on that field, the report displays a count of the rows instead of a sum of the values. To fix this, you must change the field to a formula field and convert to the CDbl() data type.

Screenshot of Crystal Reports showing Analyte Value as a formula field converted to the CDbl data type

However, converting the field to the CDbl() data type sets the number of decimals based on a system setting that is usually two. To overcome this, you can format the field by setting the number of decimals using the required configured contract number of decimals from the XML document.

Screenshot of Crystal Reports showing rounding of a formula field with the CDbl data type