S P A C E F O L D  
data... any distance... minimal time  
 
Visual FoxPro 9.0 SP2
FX Group Reset PageTotal
This topic supplies information about a new-in-SP2 FFC VFP Reporting System extension class.
GeneralAbout this class

fxResetPageTotal
provides a page count and total in any report, but is specifically designed for reports that have the "reset page number on group" option set. It stores an appropriate value to a PUBLIC variable, _ResetPageTotal, during a report run. Results are similar to system variables _PAGENO & _PAGETOTAL, but they are accurate in reports that reset _PAGENO on a group band.

Similar to the behavior of the native Report Engine with regard to _PAGETOTAL, fxResetPageTotal requires a two pass reporting process to gather its information.  If you have not already specified a two pass reporting process, fxResetPageTotal unilaterally adjusts the reportlistener's  TwoPassProcess property to perform its work.

The native Report Engine checks report expressions for use of the system variable  _PAGETOTAL to see if it needs to preprocess a report to derive this value.  In contrast to this behavior, fxResetPageTotal does not check anything in a report to determine whether you need it to work. instead, fxResetPageTotal determines that you wants it  to take action during a report run by looking to see whether a PUBLIC variable  named _ResetPageTotal var exists. If you have not declared such a variable, either explicitly or by creating a report variable with that name, fxResetPageTotal does not collect page number information.

If it is active during a report run, and if additional PUBLIC variables _ReportPageNo and _ReportPageTotal have been declared, fxResetPageTotal fills them as well, providing reliable full-report pagination data alongside the group page values.

FxResetPageTotal requires no configuration, and no stored extension data in the report.   This class adds no public methods or properties beyond its implementation of the FX API's required ApplyFX method.

ExampleExample
All three ersatz system variables can be used during the report run for pagination expressions such as the following:
   "PAGE " + TRANSFORM(_PAGENO) + " of " + TRANSFORM(_ResetPageTotal) + " in this group; " +
             TRANSFORM(_ReportPageNo) + " of " + TRANSFORM(_ReportPageTotal) " in the full report."
            
To turn on fxResetPageTotal behavior and fill these variables during a report run,  you can write application setup code like the following:
PUBLIC _RESETPAGETOTAL, _REPORTPAGENO, _REPORTPAGETOTAL
STORE 0 TO _RESETPAGETOTAL, _REPORTPAGENO, _REPORTPAGETOTAL

Alternatively, you can create report variables with this name, and an initial value of 0.

Add a reference to fxResetPageTotal to the FXs collection of the report listener you are going to use in your report.  For example, for a preview:

DO (_REPORTOUTPUT) WITH 1 && ensure a reference to a preview listener in the Report Output collection
* now you can reference the listener in the collection and add to its FXs set: _oReportOutput["1"].AddCollectionMember( ;
"fxResetPageTotal","_reportListener","",.T.) && final .T. ensures a singleton

See AlsoSee Also