Using the Group presentation style

One of the DataWindow object presentation styles, Group, is a shortcut to creating a grouped DataWindow object. It generates a tabular DataWindow object that has one group level and some other grouping properties defined. You can then further customize the DataWindow object.

StepsTo create a basic grouped DataWindow object using the Group presentation style:

  1. In the Solution Explorer, right-click the library where you want to save the DataWindow object and select Add New Entry.

  2. In the Add New Entry dialog box, select DataWindow Object from the categories list, select the Group presentation style, and click Add.

  3. Choose a data source and define the data.

    You are prompted to define the grouping column(s).

  4. Drag the column(s) you want to group on from the Source Data box to the Columns box.

    NoteMultiple columns and multiple group levels You can specify more than one column, but all columns apply to group level one. You can define one group level at this point. Later you can define additional group levels.

    In the following example, grouping will be by department, as specified by the dept_id column:

    The sample shows the Set Report Definition dialog box. At left is a Source Data box that lists columns you can use for grouping. On the right is the Columns box with one column that will be used for grouping, employee _ dept _ i d.

    If you want to use an expression, you can define it when you have completed the wizard. See “Using an expression for a group”.

  5. Click Next.

    DataWindow Designer suggests a header based on your data source. For example, if your data comes from the Employee table, DataWindow Designer uses the name Employee in the suggested header.

  6. Specify the Page Header text.

  7. If you want a page break each time a grouping value changes, select the New Page On Group Break box.

  8. If you want page numbering to restart at 1 each time a grouping value changes, select the Reset Page Number On Group Break box and the New Page On Group Break box.

  9. Click Next.

  10. Select Color and Border settings and click Next.

  11. Review your specification and click Finish.

    The DataWindow object displays with the basic grouping properties set.

This is an example of a Group style DataWindow object:

The sample shows a Group style Data Window object with the title Employee Report and the operator today ( ) beneath. Next come five column headers in the Header band, then the band labeled Header group dept _ I D displays the column dept _ i d. Then come column names in the Detail band, a Trailer group dept _ i d that gives a total by department, a summary band with the Grand Total, and a footer with  the expression " Page " + page ( ) +

What DataWindow Designer does

As a result of your specifications, DataWindow Designer generates a tabular DataWindow object and:

Here is the preceding DataWindow object in the Preview view:

The sample shows a preview of a report with the title Employee Report and the date underneath. Rules set off the horizontal band with five column headers. The first header is Department I D. The Department I D 1 0 2 appears alone in the first row, followed by many rows of four columns of data for department 1 0 2 .

Using an expression for a group

If you want to use an expression for one or more column names in a group, you can enter an expression as the GroupDefinition in the Properties window after you have finished using the Group wizard.

StepsTo use an expression for a group:

  1. Open the Properties window and select the group header band in the Design view.

  2. Click the ellipsis button next to the GroupDefinition property in the General category to open the Specify Group Columns dialog box.

  3. In the Columns box, double-click the column that you want to use in an expression.

    The Modify Expression dialog box opens. You can specify more than one grouping item expression for a group. A break occurs whenever the value concatenated from each column/expression changes.

What you can do

You can use any of the techniques available in a tabular DataWindow object to modify and enhance the grouped DataWindow object, such as moving controls, specifying display formats, and so on. In particular, see “Defining groups in an existing DataWindow object” to learn more about the bands in a grouped DataWindow object and how to add features especially suited for grouped DataWindow objects (for example, add a second group level, define additional summary statistics, and so on).

NoteDataWindow Object is not updatable by default When you generate a DataWindow object using the Group presentation style, DataWindow Designer makes it not updatable by default. If you want to be able to update the database through the grouped DataWindow object, you must modify its update characteristics. For more information, see Chapter 5, “Controlling Updates in DataWindow objects.”