Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reports: Saving page totals to a table

Status
Not open for further replies.

sschiller

Technical User
Jun 7, 2001
6
US
I am working on an application in which one runs a series of reports, "A", "B", etc., and then runs a final report reporting the total NUMBER OF PAGES in each of the previous reports, and a grand total.

I've tried to approach the problem with a while loop, and the moveToPage command, with a counter. But its not giving accurate results. Any help appreciated. Following is code from one of the lettered report pushbuttons, showing the code that doesn't work. Thanks.

-----------
method pushButton(var eventInfo Event)
var
rpt Report
rptInfo reportPrintInfo
pno number
qpno query
endVar

rptInfo.name = "SchedA"
rpt.open(rptInfo)
moveToPage(1)
pno = 1
while rpt.moveToPage(pno + 1)
pno = pno + 1
quitloop
endwhile
rpt.moveToPage(1)

qpno = Query

RSelect.db | Casno |
| _join1 |

Rsum.DB | Casno | Apg |
| _join1 | changeto ~pno |

EndQuery
qpno.executeQBE()


endMethod
 
If you structure your reports to contain a certain number of records per page using a group band, you could divide the number of records by that number and keep a running total.

Just a thought...

Mac :)

"Do not delve too deeply in the arts of your enemy and so become ensnared by them"

langley_mckelvy@cd4.co.harris.tx.us
 
Code looks ok EXCEPT:
Why are you using a quitloop statement. This will always exit the while loop on page 2 (assuming 2 or more pages in the report).
There is also a separate issue that reports may paginate differently depending on the default printer selected, e.g. the non-printable area at the end of an inkjet printer is usually larger than that on a laser printer. Paradox formats the report based on the currently selected printer and this can cause variations in the numbers of pages produced. (M$ applications do this as well, so it could well be a Windows thing!).

Another approach may be to include the summary field for "Number of Pages" on the report (create an unbound field, and define the field to be a special field, Number of Pages). Then you should only need to open the report and set pno=smallint(rpt.Number_of_Pages) : the value read from the report will be of type string.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top