OFFICE EXPRESS HELP ASSISTANT

Professional Software for Professionals

 

Using Calculated Fields in the Report Designer

Calculated fields, as by the name, allow to you to create new columns in the database that perform a calculation or calculations on existing data columns.

When creating a calculated field you'll need to define an expression for the calculation and a column name. The expression is just a simple math formula and the column name is the name you want to call the new field.

It's not as complicated as it sounds. For example if you wanted to discount a price by 10%, you could create two calculated fields that look as follows: 

Formula                       Field Name
---------------------------------------------------------------------------
[Price]*.10                  Discount
[Price]-[Discount]        New Price (the price after discount)

With these two fields created your document in the Report Designer would look like this:

Job Description             Reg Price            10% Disc.            Price w/ Discount
------------------------------------------------------------------------------------------------------------------
[Description]                     [Price]            [Discount]                      [New Price]

When the document prints with "live" data the output would look something like this:

Job Description                 Reg Price                10% Disc.          Price w/ Discount
------------------------------------------------------------------------------------------------------------------
MAINTENANCE                $25.00                      $2.50                           $22.50

To place a calculated field on the Designer canvas simply open the Toolbox, click on Calculated Field and drag the mouse pointer to the position where you want to place the field. Next, select the data table that has the field or fields that you want to perform calculations on and enter the new field name at the bottom right of the dialog box. Click Ok and you will then be asked to enter the formula for the field.

Next, calculated fields also allow you to join text fields. For example, for better spacing and appearance you could join the customer Town, State and Zip into one field and the First and Last Names into another field as follows:

Formula                                                         Field Name
---------------------------------------------------------------------------
[First Name] + ' ' + [Last Name]                     Full Name
[Town] + ', ' + [State] + ' ' + [Zip]                   TownStateZip

In the Report Designer you would do something like this

[Full Name]
[Street]
[TownStateZip]

The output would look something like this:

Mr. Jones
123 4th Street
Anywhere, NY 12345


Home | Getting Started | Table of Contents | Report Design Part 1 | Report Designer Part 3 | Report Designer 5 | Report Designer 6 |