Displaying Data in US-units

<< Click to Display Table of Contents >>

Navigation:  Introduction to Crystal Reports > Developing Own Crystal Reports >

Displaying Data in US-units

Introduction to Crystal Reports > Developing Own Crystal Reports

Next, we want to display the data in US-units. In the database, all data are stored in metric units.

Since the database does not contain any data in US-units, you need to create a formula to convert the value from metric to US units.


To create a new formula, you can right-click the Formula Fields in the Field Explorer. Select New…

Enter the name of the formula: ‘US Weight’.

Now the Formula Editor will appear.

In the Formula editor, you will find a list of the available fields. Expand the branch ‘Report Fields’. Drag-and-drop the field ‘ITEM.Weight’, into the formula editor.

Finish the formula by entering the multiplication sign (asterisk) and the conversion factor. The formula to convert from kg to lb should be:

{ITEM.Weight} * 2.20462262184877

Click the Save and close button on the toolbar.


Back in the main window of Crystal Reports, you will find the new formula under ‘Formula fields’ in the ‘Field Explorer’.

Before you insert the ‘US Weight’ field, you need to delete the original weight field from the report. Simply select the field in the design view, and click the Delete button.

Now, you need to drag-and-drop the ‘US Weight’ formula into the Details section of the report.


Finally, you must change the summary fields to summarize the ‘US Weight’ formula instead of the ‘Weight’ database-field.

To do this, select the Group Summary field in the design view, and click on it with the right mouse button. Select Edit Summary from the dropdown menu.


The ‘Edit Summary’-window pops up. Select US Weight in the Choose the field to summarize ListBox. Click OK to close the window. Repeat this for the Report Summary.


The report now shows the weight in pounds instead of kilograms.