Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Scrambled Groups
Message
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Miscellaneous
Thread ID:
01340458
Message ID:
01341059
Views:
18
>>>My report has 2 groups. There is one inside group where the details run to the end of the page and the group footer is on the following page. The problem is that the group header for the following group prints ahead of the group footer for the first group.
>>>
>>>Does anyone know how to fix this?
>>>Thanks.
>>
>>You have stumbled onto a known bug (and one that really ticks me off!!). If the group header is marked to reprint on subsequent pages .. it does .. but the report writer has incorrectly moved the record pointer to the next record so any data you try to print from the table/cursor is the wrong information. The workaround is to create report variables for each field you want to print in the group header. However, you can't just print the report variables because the first time the group header prints, the report variables haven't been set yet because the first detail band hasn't been processed yet and that's when the report variables get set. So you have to pull further tricks by counting the records printed for a group and printing the table data for the first time .. and then the report variable for subsequent times in the group header using IIF(firsttime, table.field, reportvariable) ... or separate fields with print when logic.
>>
>>Read my blog here:
>>http://cathypountney.blogspot.com/2007/12/gotcha-workaround-for-data-group-bug.html
>
>Hi again.
>Your explanation on this page was clearer and I was able to give it a try. But something is still weird.
>I created 2 variables.
>
>rcLead
>expression = lead
>initial value = lead
>reset on lead
>calc type = none
>
>rcLeadCount
>expression = lead
>initial value = 0
>reset on lead
>calc type = count
>
>Then I created 2 objects in the group header.
>The first with expression = lead and PRINT WHEN = (rnLeadCount = 0).
>The second with expression = lead + " Cont . . ." + transform(rnLeadCount".
>The second PRINT WHEN = (rnLeadCount > 0).
>
>The group footer On Exit contains: _vfp.setval(rnLeadCount,0)
>
>The result is that the first obj prints on the first page of the report and the second prints on every other page. (The group starts on a new page.) This is so even when the content of the second obj shows the value of rnLeadCount is 0. Apparently the PRINT WHEN is not working after the first page or the value of rnLeadCount is changing between the time it is evaluated for the PRINT WHEN and the text output.
>
>Does this make any sense?

These could just be typos in your example ... but ...

On the second object ... use rcLead (the report variable) as the expression ... not lead (the data field).

The Group Footer expression should be _VFP.SetVar('rnLeadCount', 0) .... notice it's VAR, not VAL ... and the rnLeadCount has to be inside of quotes ... which I see my blog doesn't show!! I'll go fix that!!
Cathy Pountney, Microsoft Visual FoxPro MVP
Memorial Business Systems, Inc. (www.mbs-intl.com)

My Website: (www.frontier2000.com)
My Blog: (www.cathypountney.blogspot.com)
My Book: The Visual FoxPro Report Writer - Pushing it to the Limit and Beyond
Free MSDN Article: What's New in the VFP 9.0 Report Writer
Free MSDN Article: The VFP 9.0 Report Writer In Action
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform