Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Page x of y in a group
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01334332
Message ID:
01334457
Views:
16
>Hi.
>I have a report sorted by a Group and want to Print Page x of Y within the Group, i.e.
> reset the No.of pages at the end of each group i.e.
>Group
>01 1 of 3
>01 2 of 3
>01 3 of 3
>02 1 of 4
>02 2 of 4
>02 3 of 4
>02 4 of 4
>etc
>Thanks in advance
>Regards,
>Gerard

It is a bug I believe. Do the following.

1. In the group band, make sure it is set to "Group starts on new page number 1"
2. Add two textboxes on the report.
3. In the first one put "Page: "+alltrim(str(_pageno))+" of"
4. In the second put alltrim(str(UpdGroupPg(sHeader.code))) *** Sheader.code is the field the group is based on.
5. Create an external function
Function UpdGroupPg(lcGrpTest)
If !Used("C_GrpPageCnt")
Create Cursor C_GrpPageCnt ( rptGrp C(20), pgCnt i )
Index On rptGrp Tag C_GrpPage
Endif
Seek lcGrpTest In C_GrpPageCnt
If Not Found([C_GrpPageCnt])
Insert Into C_GrpPageCnt (rptGrp) Values (lcGrpTest)
Endif
Replace pgCnt With Max( C_GrpPageCnt.pgCnt, _Pageno ) In C_GrpPageCnt
Return C_GrpPageCnt.pgCnt
Endfunc
6. Run the report twice
Report Form (lcReportForm) To File TestTxt2.TXT Noconsole Nodialog
Erase TestTxt2.TXT
If llPrintReport
Report Form (lcReportForm) Noconsole To Printer
Else
Report Form (lcReportForm) Noconsole Preview
Endif
Previous
Reply
Map
View

Click here to load this message in the networking platform