Is there a known circumstance where VFP will report twice the number of pages output that it should ?
I want to run the report NOCONSOLE and store the _PAGENO variable so that I can use it in the "real" run of the report.
This method works in my own DoReport() function that I wrote to manage LAN reporting - copy the report file to the local temp files drive and report from that ...
FUNCTION DoReport(tcFile, tcConditions, tcDest)
* Program....: DOREPORT
* Version....: 1.0
* Author.....: Paul Maskens
* Date.......: January 23, 1997
* Notice.....: Copyright (c) 1997 FoxWare Ltd, All Rights Reserved.
* Compiler...: Visual FoxPro 03.00.00.0711 for Windows
*
* Abstract...:
* Do report allowing for page numbering
* For multiuser copy to temporary file location first
* Run from temporary copy
*
* Changes....:
*
LOCAL lcFile, lcPath, lcTarget, lcFileMemo, lcTargetMemo
lcFile = "reports\" + tcFile
IF NOT FILE( lcFile )
ERROR "Report '" + lcFile + "' not found."
RETURN
ENDIF
lcPath = SYS(2023) +"\"
lcTarget = lcPath + tcFile
COPY FILE (lcFile) TO (lcTarget)
lcFileMemo = LEFT( lcFile, LEN( lcFile ) -1 ) + "t"
lcTargetMemo = LEFT( lcTarget, LEN( lcTarget ) -1 ) + "t"
COPY FILE (lcFileMemo) TO (lcTargetMemo)
lnPages = 0
REPORT FORM (lcTarget) &tcConditions NOCONSOLE
lnPages = _PAGENO
REPORT FORM (lcTarget) &tcConditions &tcDest
ERASE (lcTarget)
ERASE (lcTargetMemo)
RETURN
ENDFUNC
SO I tried to use this technique via the hooks provided.
I've made the following change in my config file, MYSCNFG.PRG ...
CASE tcPhase = "BEFORE REPORT"
* This phase is called just before the report is run.
* lcRepoCmd will contain the report form Command
* llRepoRun is a logical, if .f. the report command will not be run by Foxfire!.
**** PAM changed on 05/02/97
*
PUBLIC gnPages
gnPages = 0
REPORT FORM (m.ed_frxname) NOCONSOLE
gnPages = _PAGENO
*
**** end PAM on 05/02/97
IF "*:GENREPOX" $ M.RQ_NOTES
DO ("GENREPOX") WITH lcRepoCmd
llRepoRun = .f.
ELSE
llRepoRun = .t.
ENDIF
RETURN
CASE tcphase = "AFTER OUTPUT"
* This phase is called when running, previewing, or counting any request.
* Its called after the ouput has been produced.
* This phase can be used to cleanup anything from the Before Select phase.
* sql_tally will contain the number of records selected by the query.
**** PAM changed on 05/02/97
*
RELEASE gnPages
*
**** end PAM on 05/02/97
What happens is that if the report has a custom layout and that custom layout has TWO columns, the number of pages reported by VFP is the number of pages as if it had only one column!
If I change the report to be one column - then it gets the number of pages right.
Any ideas?