3 9 Group Your Data

LANSA Client

3.9 Group Your Data

A "group" of data is a set of records which relate to each other in some way. For example, employees could be related by Cost Center or Department.

You can specify that you want your data in groups either before you run your query or while you are looking at the results in the Results window.

For example, you may run a query to list all employees due for a performance review by a particular date. The query may have originally grouped its results by region, but this grouping may now be unmanageable, so it needs to be broken down into smaller groups, such as cost center. To do this, you can specify the new grouping when you get the results, rather than changing the query's definition and rerunning it. By also specifying Summary Options and linking them to the groups, you could include, for example, the number of employees and the average salary for each cost center.

Grouping criteria is specified in the Group By dialog box. This is reached by selecting the Group By command in the Options menu or via this toolbar icon.

 

The Group By dialog box contains two main areas. These are:

  • Query Fields  
    A list of all the query's fields.
  • Group By fields  
    A list of the fields by which the results will be grouped.

How It Works

From the Query fields list, select each of the fields by which you want to group your results and press the Add button. Alternatively, you can double-click on the required field in the Query fields list. The field(s) you have selected for your grouping condition will be displayed in the Group by fields list, in the sequence you have selected them.

If you want to resequence the fields, simply highlight the field to be moved and select the appropriate Up or Down button on the right hand side of the dialog box.

To remove a field from the Group By fields list, highlight the field and then select the Remove button.

To remove all the grouping, select the Remove All button.

Summary Options apply to grouped fields

If you want the summary options that you specify to be applied to your groups, select this option.

Saving your Grouping Options

When you are satisfied with the Groups you have selected, save them by selecting the OK button or pressing the Enter key, otherwise select the Cancel button or press the Esc key.

Further Information

Ý 3. Create and Run Queries