Focal Point
ON field PAGE-BREAK problem
February 05, 2008, 03:20 PM
L_GON field PAGE-BREAK problem
Hi All,
I have the following code :
DEFINE FILE CAR
LINE/I4 WITH MODEL= IF LINE EQ 10 THEN 1 ELSE LINE+1;
END
-RUN
TABLE FILE CAR
PRINT MODEL
COUNTRY
LINE
ON LINE PAGE-BREAK
WHEN LINE EQ 10
END
The problem is related with PAGE-BREAK command, I want to break the page when the line is equal to 10.
This does not works, do you know why?
WebFOCUS 7.6
Windows 2000
Output: HTML, PDF
February 05, 2008, 03:35 PM
LeahPage break is related to a BY field for what you want to do. If you only want ten lines of data on a page, consider the heading lines and any footing lines and do a SET on the LINES and PAGE.
Check out page formatting in the documentation.
Leah
February 05, 2008, 03:40 PM
L_GI know that I can use LINES AND PAGE but I want to create a conditional PAGE-BREAK, for example:
ON LINE PAGE-BREAK
WHEN (LINE EQ 10) OR ((LINE EQ 5) AND (MODEL EQ 'XXXXX'))
WebFOCUS 7.6
Windows 2000
Output: HTML, PDF
February 05, 2008, 03:55 PM
LeahWould have to test, but you still need to sort to do an ON whatever and I don't know if page-break is one you can put a condition on without doing some research. Never had to even try mostly why.
Leah
February 05, 2008, 03:59 PM
LeahCar file is kind of hard to use as an example on this, but if you change the LINE to BY LINE your WHEN conditions should work. Of course if you don't want line on the report be sure to NOPRINT and do you want it within another BY field?
Leah
February 05, 2008, 04:04 PM
Alan BTraditionally I would do this with 2 DEFINEd fields.
DEFINE FILE CAR
LINE/I4 WITH MODEL= IF LINE EQ 10 THEN 1 ELSE LINE+1;
BREAKPOINT/I4 = IF ((LINE EQ 10) OR ((LINE EQ 5) AND (MODEL EQ 'XXXX'))) THEN BREAKPOINT+1 ELSE BREAKPOINT;
END
-RUN
TABLE FILE CAR
PRINT MODEL
COUNTRY
BY BREAKPOINT NOPRINT
ON BREAKPOINT PAGE-BREAK
END
though there may be a 'more modern' approach.
Alan.
WF 7.705/8.007
February 05, 2008, 04:05 PM
jimster06Be careful using the words
LINE and
PAGE. These MAY be reserved words in WebFOCUS. I often use a variable such as LINE_CTR so that it is clearer to the next person who sees my code.
jimster06
DevStu WF 7.6.11
W7
HTML, PDF, EXL2K
February 05, 2008, 04:12 PM
Darin LeeOthers have already given the answer - you MUST have a BY field to to use PAGE-BREAK (that part is pretty clear from the documentation.) Given that, you've got to figure out another way to do it. Your problem is if you put BY LINE then you get the lines out of order so you need a combination of PAGENO and LINENO. Every time lineno reaches ten or model eq xxxx then increment pageno and set lineno=1.
Then a simple
BY PAGENO NOPRINT
BY LINENO NOPRINT
ON PAGENO PAGE-BREAK
Regards,
Darin
In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat
February 05, 2008, 04:13 PM
Darin LeeAlan beat me to the punch - and jimster's note is also important!
Regards,
Darin
In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat
February 05, 2008, 05:00 PM
Alan BI don't believe LINE would be a reserved word, LINES maybe. There is a list of watch words
here.
Alan.
WF 7.705/8.007
February 06, 2008, 04:19 AM
GamPThe following code works for me:
DEFINE FILE CAR
LINE/I4 WITH MODEL = IF LINE EQ 10 THEN 1 ELSE LINE+1;
END
TABLE FILE CAR
HEADING
"PAGE <TABPAGENO"
PRINT MODEL
BY COUNTRY
BY LINE
ON LINE PAGE-BREAK
WHEN LINE EQ 10;
END
In the example given, the LINE was calculated with MODEL, and if you then do a BY on it, it never gets higher than 10, so it will never break the page. Adding the BY COUNTRY will do the trick.
Hope this helps ...
GamP
- Using AS 8.2.01 on Windows 10 - IE11. |
 | in Focus since 1988 |
February 06, 2008, 11:44 AM
Darin LeeAnd if you compare the results of GamP's code to Alan's, you'll see that the lines and numbers are completely out of order by adding COUNTRY. Alan's code does the trick just fine.
Regards,
Darin
In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat