Focal Point
controlling page breaks

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/8991083952

November 29, 2007, 01:32 PM
Bethany
controlling page breaks
I have a report with PDF output. The report is set up to do a page break on employee so that the end report has one page per employee. The problem is that some employees have enough data that it creates a 2nd page for that employee. It's not a problem to have multiple pages for the employee, but is there a way to control where the report breaks to the 2nd page based on the amount of data?

Thanks for your help!
Bethany

Server Environment:Win2K3 Server
Apache Tomcat standalone application server
WF 7.1.3
DevStudio 7.1.4


Server Environment: Win2K3 Server WebFOCUS 7.13 Apache Tomcat standalone application server
November 29, 2007, 01:46 PM
Leah
When you say a way to control, do you mean on the employee data which flows to a second page?

There is a lines parameter that can set the number of lines per page.


Leah
November 29, 2007, 01:59 PM
FrankDutch
the command is

SET LINES = 66

or whatever you like

you will have to play with it, to get the best result, depends on header and footer size




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

November 29, 2007, 02:34 PM
susannah
if i understand you correctly, you don't want to page-break if the last employee has only a few remaining lines of data, is that right?
you can set up some switches
-* how many lines per page do you want
-SET &mylpp = 66 ;
-* how many lines tolerable for nobreak
-SET &mymin = 10 ;
-* a simple flag that increments on employee change
BODYCOUNT/I8=IF EMPLOYEE EQ LAST EMPLOYEE THEN LAST BODYCOUNT ELSE 1+ LAST BODYCOUNT;
-* whats the max lines per employee
LINENUM/I8=IF EMPLOYEE EQ LAST EMPLOYEE THEN LAST LINENUM + 1 ELSE 1;
-* how many remainder lines 
REMAIN/I2=IMOD( LINENUM, &mylpp , 'I2');
-* now a fake page-breaker  ; 
-* when you encounter a new guy and 
-*  the end of the last guy is less than your page break criteria 
-*  then dont page break.
DEALorNODEAL/I8=IF (EMPLOYEE NE LAST EMPLOYEE) AND ( LAST REMAIN LE &mymin) THEN LAST BODYCOUNT ELSE BODYCOUNT;
ON DEALorNODEAL PAGE-BREAK
ON EMPLOYEE SUBHEAD ...

(mske sure you have nice subheads to id the employee if you switch mid page)
...

This message has been edited. Last edited by: susannah,




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
November 29, 2007, 04:32 PM
Bethany
Does SET LINES = 66 work with PDF output???


Server Environment: Win2K3 Server WebFOCUS 7.13 Apache Tomcat standalone application server
November 29, 2007, 04:55 PM
Francis Mariani
It doesn't. I thought it did.

SET LINES = 5
TABLE FILE GGSALES
SUM
UNIT
DOLLAR
BY REGION
BY STCD
BY CATEGORY
BY PRODUCT
ON TABLE PCHOLD FORMAT PDF
END



Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
November 29, 2007, 05:13 PM
Leah
It used to work, haven't in a while though. I know in the 5.3.6 world I had a report I'd used it with due to footers. Suppose this is something that was 'fixed' recently.


Leah
November 29, 2007, 05:17 PM
FrankDutch
I will give it a try (tomorrow) my bed is calling....




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

November 29, 2007, 05:27 PM
Leah
Good sleep, I just noticed you registered on my wedding anniversary. long way from here to Amsterdam.


Leah
November 29, 2007, 06:02 PM
susannah
set lines should just set the place where the headers repeat, so for pdf i would set lines = 9999 and then pdf just handles its own re-headering.




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
November 29, 2007, 06:40 PM
dwf
Hi, Bethany. I have what is an approach, more than a solution. I will shorthand it, on the assumption that you've been doing this a while, and can fill in the details.

This approach requires two passes (at least) at the data. First pass, in addition to printing your data, you count the number of lines per employee (emp_counter). Put that in a hold file. Second pass (the report, hopefully), you create some kind of field to break on. For example, you might use IMOD to get the remainder of a divison of emp_counter by 50. That remainder (emp_remainder) would be zero on every fiftieth record. Maybe create another variable - say pg_count - that starts at 1 and is incremented when emp_remainder = 0. So it's 1 for the first 50 records, 2 for the next 50, etc. Then sort by employee within pg_count and page-break on employee. Or by pg_count within employee and break on pg_count. Either will work, as long as you handle the details properly.

You can build a more sophisticated algorithm, if you want. Might take a third pass (not sure). You could specify a page break within employee at 50 lines only if the total lines for the employee exceeds 60, for example. The important point is counting lines by employee and using that to control the page break.


dwf
November 30, 2007, 12:43 AM
susannah
which would seem to be the code i just gave her a couple of posts up, si?




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
November 30, 2007, 09:46 AM
dwf
Oh, Susannah Music You want me to read the posts before I reply to them? Excessive preparation.


dwf
November 30, 2007, 12:52 PM
susannah
Good One




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
December 05, 2007, 10:53 AM
Bethany
Thanks for the suggestions/solutions. I was able to make it work by adding an additional sort field and then use the NO SPLIT on the that field. I'll save the other solutions for another time when NOSPLIT won't do the trick...and I'm sure that day will eventually come.

Thanks again!


Server Environment: Win2K3 Server WebFOCUS 7.13 Apache Tomcat standalone application server