Skip to main content

Group and sort

The Group And Sort panel groups the records of a template and puts them in order. It adds the group bands (the group header and the group footer) and sets the fields that grouping and sorting use. This page describes the panel and the properties of the group bands. For the other bands, see Report bands.

The panel​

The panel is one of the designer panels, with Field List, Report Explorer and Properties, as described in Panels. Its title is Group And Sort.

ButtonWhat it does
Add a GroupAdds a row for a new group. You choose the grouping field from the field list in the row.
Add a SortAdds a row for a sort field. You choose the field from the field list in the row.
Move UpMoves the selected row one step up.
Move DownMoves the selected row one step down.
RemoveRemoves the selected row from the panel.

Each row has options:

OptionWhat it doesValues
Sort OrderSets the direction of the order on the row's field.Ascending, descending or none.
Show HeaderShows the group header band. Group rows only.Ticked or not ticked.
Show FooterShows the group footer band. Group rows only.Ticked or not ticked.

When you delete a group whose header or footer is not empty, the program asks: "The group header or footer you want to delete is not empty. Do you want to delete this band along with its controls?". Decide before you continue, because deleting the band deletes its controls.

Add a group​

  1. Click Add a Group in the Group And Sort panel.
  2. Choose the grouping field from the field list in the new row, such as Material_Name.
  3. Leave Show Header ticked so that a Group Header band appears in the template. Tick Show Footer if you want a Group Footer band for the totals of the group.
  4. Drag the field to the group header band, or add controls to it, so that the group name prints.

Each record in the table has a value in the grouping field. Records with the same value are grouped and print under one header. Set Sort Order on the grouping field to control the direction in which the groups appear. If you add more than one group, they nest in the order of their rows in the panel. Use Move Up and Move Down to change that order.

Add a sort​

Add a Sort orders the records inside the Detail band without grouping them. Click Add a Sort, choose the field, and then choose Sort Order. If you add more than one sort field, the first in the panel is the main one, and the next ones break ties among records that are equal in the earlier ones.

Group band properties​

Select a Group Header or Group Footer band in the designer, and then open the Properties panel. It has the properties below, and the panel shows the value names as they are.

PropertyWhat it doesValues
Group FieldsThe grouping fields the band is based on, each with its order. It is what the Group And Sort panel edits.One or more fields with a direction.
Sort FieldsThe sort fields of the Detail band. The panel edits them with Add a Sort.One or more fields with a direction.
LevelThe position of the group among the groups of the template.A number.
Group UnionHow the group is split between pages.None: the group splits over several pages if one page cannot hold it. Whole page: the whole group prints on one page, header and footer included, and moves to the next page if it does not fit. With first detail: the group splits as usual, but if the header does not fit together with the first record after it, both move to the next page.
Keep TogetherWhether the band may be split over two pages.Ticked: the band stays on one page.
Page BreakWhere a page break is inserted near the band.No break, before the band, after the band, before the band except the first time, after the band except the last time.
Repeat Every PagePrints the group header again at the top of the next page when the group moves to it.Ticked or not ticked.
Print at BottomPrints the group footer at the bottom of the page instead of right after the last record.Ticked or not ticked.
Sorting SummaryOptions for ordering the groups by a calculated value instead of the grouping field.Set in the group sorting summary editor window.

Filtering​

This panel does not filter the records of the whole template. The program hides the Filter String property of the report, so you cannot limit the records with a condition from the designer. The records of a template are what the data source of the document type returns, and the filtering for the document you print happens in the stored procedure, not in the template. See What alameen does not allow in the designer and Advanced printing data sources.

To hide a control or band when a condition is true without changing the records, see Styles and conditional appearance.

Example: total per material​

On a sales invoice for the customer "Alnakheel Est.", the material "Blue ink pen" appears on two lines. The quantity of the first is 10 and of the second is 5. You want the total of each material to print after its lines.

  1. Click Add a Group and choose Material_Name.
  2. Tick Show Footer so that the Group Footer band appears.
  3. Click Add a Sort and choose Number so that the lines inside the group stay in the order you entered them.
  4. In the group footer, add a text with the expression sumSum([Quantity]). Summaries explains it.

The preview prints the material "Blue ink pen" with its two lines 10 and 5, and the footer shows 15.

This page applies to alameen ERP 10, version 10.1.79.764.