4D v16.3

Sorting records and adding breaks

Home

 
4D v16.3
Sorting records and adding breaks

Sorting records and adding breaks  


 

 

An important feature of the Quick Report editor is the ability to sort the records in your report. You sort records for two reasons:

  • To view records in a particular order,
  • To create groups of records and subtotal areas in the report for the purpose of reporting summary calculations for groups.

You can specify a sort order at any time using the pop-up window associated with the column header. You choose a sort order (ascending or descending) using the Sort Order menu of this window:

This works for columns containing fields or formulas:

For more information about formulas, refer to Associating formulas with a quick report.

You can sort a report on several levels. Sort levels are displayed in order as break rows (subtotals) in the report design area. To change the level of a sort, you can drag and drop the break rows to move them up or down within the report design area:

In a quick report, you set break levels to separate or “break” records into groups according to values in one or more sort fields. A break area is printed at each break level. You can print summary calculations in the break area. The summary calculations — sum, average, minimum, maximum, count and standard deviation — are calculated for each group of records. 

Break levels are determined by the sort levels and Break rows. For example, if you sort records by Sales Region, 4D inserts a break between each group of records that have the same sales region. These rows are automatically inserted when a sort is defined. 

After you add a subtotal row to the quick report, you can request summary calculations on each break. For example, you can insert a summary calculation in a subtotal row to display subtotals for sales from each state in a marketing region. For more information about adding summary calculations to Subtotal and Total rows, refer to Adding summary calculations.

The label of a subtotal row indicates which change in value triggers the break.

You can improve the appearance and clarity of your reports by labeling each Subtotal row using the value of the Break field. 

To request that the value of a Break field be printed in a label placed in the Break area, use the number sign (#) in the label. For example, the text “Total salaries for # department” will insert the department name (in this case, the value of the Department field) in place of the number sign when the report is printed.

The number sign does not need to be placed in the same column as the Break field. It will display the value of the Break field in any cell in the Subtotal row.

The following figure illustrates the use of the number sign in a label in the Subtotal row:

In the report generated, the following break row will be added to each country group:

You can delete any break level along with the associated sort of the column either by:

  • choosing None in the "Sort Order" menu of the pop-up window for the associated column, or
  • selecting Remove this break row in the pop-up window for the row:

The break level is then removed. Note that in both cases, the column is no longer sorted. If you want to sort a column without adding a corresponding break level, you can simply hide the break row using the pop-up window (see Hiding rows or columns).

 
PROPERTIES 

Product: 4D
Theme: Quick reports (64-bit)

 
HISTORY 

 
ARTICLE USAGE

4D Design Reference ( 4D v16)
4D Design Reference ( 4D v16.1)
4D Design Reference ( 4D v16.3)