Re: Report construction
Posted in 1998
Generally, I avoid SKIP TO TOP OF PAGE instructions because of the sort of problem you describe. Another way to get similar and often more satisfying results is to use NEED xx LINES instructions, where xx is the number of lines available for your report body. If you're at the top of the report body, then, the instruction is ignored, but otherwise it creates a page break. It seems to give me more control. Hamish McHamish wrote in message <366f9f77.607682043@news.globalnet.co.uk>... >Hi, > >Our delivery notes are 48 lines deep. The first 21 lines are for >printing header information. The middle 15 lines are for delivery note >details ( 5 times 3 - it takes 3 lines to display all the information >needed for each delivery line ). Then 2 lines for the page trailer >which will either show "Continued" or the delivery note totals. The >bottom margin takes up the last 10 lines in which nothing is printed >since there is pre-printed text on the delivery note. > >The basic outline of the REPORT function is as follows: > >REPORT delivery_note_print (p_delivery_note) > >DEFINE some variables > >OUTPUT > LEFT MARGIN 0 > RIGHT MARGIN 136 > TOP MARGIN 0 > BOTTOM MARGIN 10 > PAGE LENGTH 48 > >FORMAT > PAGE HEADER > header stuff.... > > PAGE TRAILER > IF NOT f_endnote THEN > PRINT COLUMN 56, "Continued" > ELSE > PRINT invoice totals > END IF > > BEFORE GROUP OF f_delivery_note > select some data and set up variables > > AFTER GROUP OF f_delivery_note > LET f_endnote = TRUE > PRINT a line of stuff if a certain indicator set > SKIP TO TOP OF PAGE > > ON EVERY ROW > PRINT delivery note details line 1 > PRINT delivery note details line 2 > PRINT delivery note details line 3 > >The problem I have is that if a delivery note has 5 lines ( 5 x 3 >printed lines ) then the SKIP TO TOP OF PAGE in the AFTER GROUP OF >f_delivery_note will cause the PAGE HEADER to display the next >delivery note header details before printing the totals of the >delivery note I have just processed. >If the delivery note being processed has a number of lines not >divisible by 5 then the problem does not exist. >One thought I had was during the ON EVERY ROW processing, if the >printed delivery line was the 5th one then test for this and SKIP TO >TOP OF PAGE, sure in the knowledge that the header will be that of >current delivery note. The problem with this is that on the next >record to be processed the AFTER GROUP OF f_delivery_note will throw >another page thus wasting paper. The problem is I don't know during >the processing of the current line that the next record will be for a >different delivery note and thus print the totals without printing >another, unnecessary, header. >I would prefer not to do any additional processing in the ON EVERY ROW >section and just leave this to deal with each line and look at trying >to resolve this in the other sections. > >Did that all make sense? :) > >Anybody got any ideas on the best approach to this problem? I was >thinking that maybe there is a 'best practice' to dealing with >printing on pre-printed stationery where there is a header, trailer, >bottom margin and stuff inbetween. > >Any help and/or assistance would be most appreciated. > >Cheers, Hamish.