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.

You specify columns on which to group a DataWindow in the Set Report Definition page of the Group DataWindow wizard, or in the Specify Group Columns dialog box that you open from the DataWindow painter.

Figure 22-6 shows selections for grouping by department, as specified by the dept_id column.

Figure 22-6: Selecting a column on which to group a report

The sample shows the Set Report Definition dialog box. At left is a Source Data list 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.

Figure 22-7 is an example of a Group style DataWindow object in the Design view of the DataWindow painter.

Figure 22-7: Design view of a DataWindow with a Group presentation style

The sample shows the Design view for a Group style Data Window object with the title Employee Report and the today ( ) expression below the title. The Header band has five column headers. Below that, a band labeled Header Group dept _ I D displays the column dept _ i d. Then the Detail band lists the remaining four column names. The Trailer group dept _ i d band includes an expression for a salary total by department, and a summary band has an expression for the Grand Total of salaries for all departments combined. The footer band has an expression for the page number.

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

  1. Select File>New from the menu bar.

    The New dialog box displays.

  2. Choose the DataWindow tab page and the Group presentation style, and click OK.

  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 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, and define additional group levels later.

    NoteIf you want to use an expression If you want to use an expression, you can enter it as the Group Definition on the General page in the Properties view after you have finished using the Group Wizard. You can specify more than one grouping item expression for a group. A break occurs whenever the value concatenated from each column/expression changes.

  5. Click Next.

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

  6. Specify the Page Header text, specify page break and page numbering properties for data groups, and click Next.

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

    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.

  7. Select Color and Border settings and click Next.

  8. Review your specification and click Finish.

    The DataWindow object displays with the basic grouping properties set.

What PocketBuilder does

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

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.

For information about the bands in a grouped DataWindow object and how to add features especially suited for grouped DataWindow objects (such as adding a second group level, defining additional summary statistics, and so on), see “Defining groups in an existing DataWindow object”.

NoteDataWindow object is not updatable by default When you generate a DataWindow object using the Group presentation style, PocketBuilder 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 20, “Controlling Updates in DataWindow Objects.”