BackPrevious Page Next PageNext

Summary Functions

The following are functions that can be used for creating summaries. They are divided into two types: normal functions and running functions. Both types of summaries are normally displayed in a group header, group footer, report header, or report footer and can be used in multiple places. If you want to see a running total on each detail line they can be put into the detail section as well.

A normal function calculates all records and returns only one fixed value that is reset to 0 for each group.

A running function calculates a value on each record and does not reset to 0 for each group. It is like the total sum of money for each transaction that is recorded on your checkbook. Each time you deposit or withdraw money from the bank, the record will compute the total of your checking account balance.

Examples

The following are two examples comparing normal functions and running functions.

Sum on table

Sum on crosstab

Sum on table

  1. Open the catalog file SampleReports.cat in <install_root>\Demo\Reports\SampleReports.
  2. ClickFile > New > Web Report.
  3. Drag the Table (Group Left Above) button Group Left Above Table button from the Components panel to the web report. The Create Table wizard appears.
  4. In the Data screen, select WorldWideSalesBV from Data Source 1.
  5. In the Display screen, add the fields Customer Name, Order ID, and Quantity to be dispalyed in the table.
  6. In the Group screen, add Country as the group-by field.
  7. In the Summary screen, go to the Dynamic Resources > Aggregations node, click <New Aggregation...>.
  8. In the New Aggregation dialog, click Choose button beside the Mapping Name text field and select Quantity as the mapping name, and then select RunningSum as the aggregate function. A default aggregation name RunningSum_Quantity is provided, click OK to create the aggregation.

    Create RunningSum_Quantity

  9. Repeat the step above to create another aggregation named Sum_Quantity, which uses Quantity as the mapping name, and Sum as the aggregate function.

    Create Sum_Quantity

  10. In the sum on box on the right, select the Country group, add the two aggregations created above as the summary fields, and change their positions to Header so as to put them in the group header.

    Add Summaries for Table

  11. Click Finish. Then adjust the column width in the table to make the RunningSum_Quantity label fully displayed.
  12. Preview the table to check the summaries.

    Preview Table

Sum on crosstab

  1. Open the catalog file SampleReports.cat in <install_root>\Demo\Reports\SampleReports.
  2. Click File > New > Web Report.
  3. Drag the Crosstab button Crosstab buttonfrom the Components panel to the web report. The Create Crosstab wizard appears.
  4. In the Data screen of the wizard, select SaleStat from Data Source 1.
  5. In the Display screen, add the fields Assigned Region to the Columns box and Year to the Rows box, then create two dynamic aggregations RunningSum_Quantity and Sum_Quantity as described in steps 9 to 11 of the above example and add them as the summary fields.

    Add Crosstab Fields

  6. In the Style screen select Basic as the report style. Click Finish.
  7. To distinguish the two kinds of aggregate functions, select the four summary fields which use RunningSum as the aggregate function and set their Background property to Green.

    Set Background for RunningSum

  8. Preview the crosstab. The running summary values are highlighted in green for easy comparison. Note that the running aggregate function is only supported on crosstab columns. It does not perform running totals on the row total values.

    Preview Crosstab

BackPrevious Page Next PageNext