FIX: Reprint Group Header Problem with Two Data Groupings

ID: Q147574

The information in this article applies to:

SYMPTOMS

If you create a report with two or more data groupings with the "Reprint Group Header on Each Page" check box selected for all data groupings, the groupings will print in incorrect order on the first page and on subsequent pages when a new outer grouping starts on a new page.

WORKAROUND

NOTE: For this workaround to work, each new outer grouping must start on a new page.

Follow the steps in the "Steps to Reproduce Problem" section of this article, and then make the following changes to the report:

1. In the Data Grouping dialog box, select the shipper_id group, and select

   the "Start Each Group on a New Page" check box.

2. Move all fields from Group Header 1 to the Page Header (you may need to
   enlarge the Page Header band), and shrink the Group Header 1 band height
   to 0.

3. Create a report Variable, and give it the following settings:

   Name - grpcount
   Value to Store - grpcount + 1
   Initial Value - 0
   Calculate  - Sum
   Reset - shipper_id

4. Select all the fields in Group Header 2. Copy them, and then paste them
   into the Page Header. On each of these new fields in the Page Header,
   choose Print When, and in the "Print Only When Expression Is True" text
   box, enter this expression:

   grpcount = 0

   Select the "Remove Line If Blank" check box.

5. On all the fields in Group Header 2 choose Print When, and in the "Print
   Only When Expression is True" text box, enter this expression

   grpcount  >  0

   Select the "Remove Line If Blank" check box.

STATUS

Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. This problem has been fixed in Visual FoxPro 5.0a.

MORE INFORMATION

Steps to Reproduce Problem

1. Open Orders.dbf from the Tastrade database located in the

   Samples\Mainsamp\Data subdirectory.

2. Create a new index tag named ShipCust on this expression:

   shipper_id + customer_id

3. Create a new report, and add the Orders table to the Data Environment.

4. In the properties sheet of the Data Environment, in the Data tab of the

   Cursor object, set the Order property to ShipCust.

5. Add two Data Groupings to the report, the first (outer) being
   shipper_id and the scond (inner) being customer_id. In both cases,
   select the "Reprint Group Header on Each Page" check box.

6. Add a label named Outer Group to the Group Header 1, and add a label
   named Inner Group to the Group Header 2.

7. Preview the report. Note that Inner Group prints above Outer Group on
   the first page. It is also possible to arrange the report so that the
   shipper_id changes between pages, in which case the problem repeats
   itself on the first page that displays the new shipper_id.

REFERENCES

For more information about the technique used in this article, please see the following article in the Microsoft Knowledge Base:

   ARTICLE-ID: Q94343
   TITLE     : Obtaining Number of Data Groups in .FRX Without Using UDF
Keywords          : kbtool kbVFp kbVFp300bbug kbVFp500afix kbVFp500bug buglist3.00 FxtoolRwriter kbbuglist kbfixlist
Version           : 3.0 3.0b 5.0
Platform          : MACINTOSH WINDOWS
Issue type        : kbbug
Solution Type     : kbfix

Last Reviewed: November 1, 1997