Adding Calculated Fields

Calculated fields display statistics gathered while a report runs. For example, if you group your records by state, you could use a calculated field to print the total number of customers in each state.

*  To insert a calculated field into your report layout:

  1. Place your cursor in the Group Header, Query Summary, or Group Summary section of the layout.

  2. Access the Insert Calculated Field dialog box using one of the following options:

    • Click Insert Calculated Field  button on the Object Toolbar.

    • Select Insert, then Calculated Field.

    • Right-click Calculated Fields in the Object Explorer (see Using the Object Explorer) and select Insert.

  3. Enter the requested information in the Insert Calculated Field dialog box.

    1. In Name, enter a name for the calculated field.

      Assign a name that will help you identify the calculated field. For example, numsales for Number of Sales, or avgsale for Average Sale.

    2. In Fields/Expressions, select a column or expression from the query.

    3. In Functions, select the function you want to perform on the specific column or expression.

      For character or date columns (or expressions that contain character or date columns), use the Count function. For example, to count the number of sales in the Order Details and Analysis report, we performed a Count function on the Order Date.

      For numeric columns, you can use any function (summation, average, count, minimum, maximum, variance, and standard deviation).

  4. Click OK to return to the report layout.

    Note:

    If you select Summation or Average as the function,SQR Production Reporting Studio can round each column value to a specific number of digits before adding all the values. To round the values, select Round to and enter the number of digits to the right of the decimal point to use in the rounding calculation. To ensure that a manual calculation of report values matches the calculated total, enter the same number of digits as the width specified in the column’s object properties.

Rounding only applies to decimal variables. SQR Production Reporting Studio disables the option for integers, since integers have no digits after the decimal point.