Problems with reports
Posted in 1999
Topics: General Discussion
I have this report situation: ...... ORDER BY <key of customer> ...... PAGE HEADER <Header of customer> EVERY ROW <row of customer> AFTER GROUP OF customer <totals> SKIP TO TOP OF PAGE I need a header in every page regarding the general data of the customer (like address etc.), so i need a "PAGE HEADER" section. Then i have to print all data regarding the customer (EVERY ROW section). Then, when the customer changes (AFTER GROUP) i have to print totals and to pass to another new page (SKIP TO TOP OF PAGE). But, at this point, i observed that in the new page header it prints the old customer data! Then it prints the new rows (regarding the NEW customer). I launch the report passing to it the new record every time, like this: START REPORT rep FOREACH ...into rec.* OUTPUT TO REPORT rep(rec) END FOREACH FINISH REPORT rep So it seems that after the "SKIP TO TOP OF PAGE" instruction, it remains in the report and executes the "PAGE HEADER" section, with old header data and then exits from the report, instead of exiting from the report and doing the next FOREACH instruction. Is there someone who can help me? Thanx, Guido. P.S. Sorry for my bad English!!! :-)))))
Hi, could it be that you're using a variable that holds the data before you print a line in the "on every row"-section? If so, try using a different variable for the "page header"-section, because otherwise you mix up the contents of the two different sections. And remember to clear the variable before filling in new data and printing it. Kind regards Roland Wintgen Guido Cirilli schrieb: > > I have this report situation: > > ...... > ORDER BY <key of customer> > ...... > PAGE HEADER > <Header of customer> > > EVERY ROW > <row of customer> > > AFTER GROUP OF customer > <totals> > SKIP TO TOP OF PAGE > > I need a header in every page regarding the general data of the customer > (like address etc.), so i need a "PAGE HEADER" section. > Then i have to print all data regarding the customer (EVERY ROW section). > Then, when the customer changes (AFTER GROUP) i have to print totals and to > pass to another new page (SKIP TO TOP OF PAGE). > But, at this point, i observed that in the new page header it prints the > old customer data! Then it prints the new rows (regarding the NEW customer). > I launch the report passing to it the new record every time, like this: > START REPORT rep > FOREACH ...into rec.* > OUTPUT TO REPORT rep(rec) > END FOREACH > FINISH REPORT rep > > So it seems that after the "SKIP TO TOP OF PAGE" instruction, it > remains in the report and executes the "PAGE HEADER" section, with old > header data and then exits from the report, instead of exiting from the > report and doing the next FOREACH instruction. > Is there someone who can help me? > Thanx, Guido. > > P.S. > Sorry for my bad English!!! :-)))))
Guido Cirilli wrote: > > I have this report situation: > > ...... > ORDER BY <key of customer> > ...... > PAGE HEADER > <Header of customer> > > EVERY ROW > <row of customer> > > AFTER GROUP OF customer > <totals> > SKIP TO TOP OF PAGE > > I need a header in every page regarding the general data of the customer > (like address etc.), so i need a "PAGE HEADER" section. > Then i have to print all data regarding the customer (EVERY ROW section). > Then, when the customer changes (AFTER GROUP) i have to print totals and to > pass to another new page (SKIP TO TOP OF PAGE). > But, at this point, i observed that in the new page header it prints the > old customer data! Then it prints the new rows (regarding the NEW customer). > I launch the report passing to it the new record every time, like this: > START REPORT rep > FOREACH ...into rec.* > OUTPUT TO REPORT rep(rec) > END FOREACH > FINISH REPORT rep > > So it seems that after the "SKIP TO TOP OF PAGE" instruction, it > remains in the report and executes the "PAGE HEADER" section, with old > header data and then exits from the report, instead of exiting from the > report and doing the next FOREACH instruction. That is because the page break was forced in an after group of section where the current record is the old customer. Move the page break to a BEFORE GROUP OF <customer key> section and either move the headers to that section as well of protect the "SKIP TO TOP OF PAGE" statement with a test of a global variable so there is not a blank page at the beginning of the report, vis: GLOBALS firstcust integer LET firstcust = TRUE .... FOREACH ... REPORT ... ... REPORT this _report(.... .... PAGE HEADER <header prints> BEFORE GROUP OF <customer key> IF NOT firstcust THEN SKIP TO TOP OF PAGE ELSE LET firstcust = FALSE END IF EVERY ROW .... AFTER GROUP OF <customer key> <print totals> END REPORT Art S. Kagel