Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Khurram Tahir
  Where is Khurram Tahir?
 Karachi
 Pakistan
 Khurram Tahir
 Tags
Subject: _pagetotal resetting on group
Thread ID: 112294 Message ID: 112294 # Views: 12 # Ratings: 0
Version: Visual FoxPro 9 Category: Reports and Printers
Date: Tuesday, November 07, 2006 6:32:11 AM         
   


Borilav Borissov given coding

**********

rand(-1)
SELECT 0
CREATE CURSOR C_GrpPageCnt ( rptGrp i, pgCnt i )
INDEX on RptGrp TAG RptGrp
INSERT INTO C_GrpPageCnt VALUES ( 1, 0 )
INSERT INTO C_GrpPageCnt VALUES ( 2, 0 )
INSERT INTO C_GrpPageCnt VALUES ( 3, 0 )


CREATE CURSOR C_TmpDetails ( rptgrp i, rptval b )
SET RELATION TO RptGrp INTO C_GrpPageCnt
FOR lnI = 1 TO 30
INSERT INTO C_TmpDetails values ( 1, RAND() * 10000)
ENDFOR
FOR lnI = 1 TO 15
INSERT INTO C_TmpDetails values ( 2, RAND() * 10000)
ENDFOR
FOR lnI = 1 TO 40
INSERT INTO C_TmpDetails values ( 3, RAND() * 10000)
ENDFOR

REPORT FORM PgCntByGroup TO FILE fakefile.txt noconsole

REPORT FORM PgCntByGroup preview


FUNCTION UpdGroupPg()
*/ Using MAX() on the replace to prevent resetting to lower page count
*/ value when the second instance of the report is actually run
replace C_GrpPageCnt.PgCnt WITH MAX( C_GrpPageCnt.PgCnt, _pageno )
RETURN C_GrpPageCnt.PgCnt
ENDFUNC

*********

I have follwing tables in my report

cn420="1"
TMPFN3D="Wsvdtl1."
FP99="OMMNU\P"

Wsvdtl1.dbf && Parent
Salgh.dbf && Child
Salgrh.dbf && Child

I have 2 detail bands and i grouped on EVAL("Wsvdtl"+cn420+".acccd")
detail band 1: Salgh.dbf records
detail band 2: Salgrh.dbf records

According to your given solution i have kept the follwing line in my report page footer which is containing only this line

"Page: " + str( _pageno ) + " of " + str( UpdGroupPg() )

In my program

Here i kept your above given coding starting from
rand(-1)
.
.
.
.
FOR lnI = 1 TO 40
INSERT INTO C_TmpDetails values ( 3, RAND() * 10000)
ENDFOR

SELECT WSVDTL&CN420

REPORT FORM &FP99\P_A_PWSHTV TO FILE &FP99\fakefile.txt NOCONSOLE ;
FOR &TMPFN3D.PRNT = [M] AND (&TMPFN3D.FMDT >= FDT AND &TMPFN3D.TODT <= TDT)

REPORT FORM &FP99\P_A_PWSHTV TO PRINTER PROMPT NODIALOG PREVIEW FOR &TMPFN3D.PRNT = [M] AND (&TMPFN3D.FMDT >= FDT AND &TMPFN3D.TODT <= TDT)

I have done this but _pagetotal is not resetting on a group change

You said that group on "RptGrp" how can i do this ?
can you expalin in detail according to my report

ENTIRE THREAD

_pagetotal resetting on group Posted by Khurram Tahir @ 11/7/2006 6:32:11 AM
RE: _pagetotal resetting on group Posted by Borislav Borissov @ 11/7/2006 8:35:39 AM
RE: _pagetotal resetting on group Posted by Khurram Tahir @ 11/7/2006 9:07:10 AM
RE: _pagetotal resetting on group Posted by Borislav Borissov @ 11/7/2006 9:29:48 AM
RE: _pagetotal resetting on group Posted by Khurram Tahir @ 11/7/2006 11:19:31 AM
RE: _pagetotal resetting on group Posted by Borislav Borissov @ 11/7/2006 11:35:26 AM
RE: _pagetotal resetting on group Posted by Khurram Tahir @ 11/7/2006 12:54:19 PM