subhead repeats twice at few pages. Can anyone let me know the fix for the same. (Something wrong with my WHEN condition on subheads)
TABLE FILE GGSALES PRINT STCD AS '' DOLLARS AS '' AND COMPUTE ROWCNT/I9 = LAST ROWCNT + 1; NOPRINT BY CATEGORY NOPRINT BY STCD NOPRINT BY TOTAL ROWCNT NOPRINT WHERE STCD IN ('R1109','R1044') HEADING "HEADING"
ON TABLE SUBHEAD "TABLE SUBHEADING"
ON ROWCNT SUBHEAD ""Red STORE" WHEN (STCD NE LAST STCD OR TABPAGENO NE LAST TABPAGENO) AND STCD EQ 'R1109';
ON ROWCNT SUBHEAD ""Green STORE" WHEN (STCD NE LAST STCD OR TABPAGENO NE LAST TABPAGENO) AND STCD EQ 'R1044';
ON TABLE PCHOLD FORMAT PDF ON TABLE SET PAGE NOPAGE ON TABLE SET STYLE * UNITS=IN, PAGESIZE=LEGAL, ORIENTATION=LANDSCAPE, SIZE=8, FONT=ARIAL, BOTTOMMARGIN=0, TOPMARGIN=0, LEFTMARGIN=0.30, GRID=ON, SQUEEZE=ON, $
TYPE=SUBHEAD,JUSTIFY=RIGHT,SIZE=15,WIDTH=2.50, WRAP=2.50,BACKCOLOR=RED, WHEN = STCD EQ 'R1109',$ TYPE=SUBHEAD,JUSTIFY=RIGHT,SIZE=15,WIDTH=2.50, WRAP=2.50,BACKCOLOR=GREEN, WHEN = STCD EQ 'R1044',$
TYPE=HEADING,SIZE=6,STYLE=BOLD,FONT=ARIAL,HEADALIGN=BODY,BORDER=OFF,$ TYPE=REPORT,LINEBREAK='CR',$ TYPE=REPORT, GRID=ON, FONT='TIMES NEW ROMAN', SIZE=10, BACKCOLOR='NONE',
ENDSTYLE END -EXIT
Thanks, YashThis message has been edited. Last edited by: <Kathryn Henning>,
TABPAGENO is a special field and it appears LAST TABPAGENO is always zero, so you may not be able to use that syntax.
This might illustrate the issue:
TABLE FILE GGSALES
PRINT
STCD AS '' DOLLARS AS ''
COMPUTE ROWCNT/I9 = LAST ROWCNT + 1;
TABPAGENO
COMPUTE LAST_TABPAGENO/I9 = LAST TABPAGENO;
BY CATEGORY
BY STCD
BY TOTAL ROWCNT
WHERE STCD IN ('R1109','R1044')
HEADING
"HEADING"
ON TABLE SUBHEAD
"TABLE SUBHEADING"
ON ROWCNT SUBHEAD
" "
"RED STORE"
WHEN (STCD NE LAST STCD OR TABPAGENO NE LAST TABPAGENO) AND STCD EQ 'R1109';
ON ROWCNT SUBHEAD
" "
"GREEN STORE"
WHEN (STCD NE LAST STCD OR TABPAGENO NE LAST TABPAGENO) AND STCD EQ 'R1044';
ON TABLE PCHOLD FORMAT PDF
ON TABLE SET PAGE NOPAGE
ON TABLE SET STYLE *
TYPE=REPORT,
UNITS=IN, PAGESIZE=LEGAL, ORIENTATION=LANDSCAPE, SIZE=8, FONT=ARIAL, BOTTOMMARGIN=0.30, TOPMARGIN=0, LEFTMARGIN=0.30, SQUEEZE=ON,$
TYPE=SUBHEAD,JUSTIFY=RIGHT,SIZE=15,WIDTH=2.50, WRAP=2.50,BACKCOLOR=RED, WHEN = STCD EQ 'R1109',$
TYPE=SUBHEAD,JUSTIFY=RIGHT,SIZE=15,WIDTH=2.50, WRAP=2.50,BACKCOLOR=GREEN, WHEN = STCD EQ 'R1044',$
TYPE=HEADING,SIZE=6,STYLE=BOLD,FONT=ARIAL,HEADALIGN=BODY,BORDER=OFF,$
TYPE=REPORT,LINEBREAK='CR',$
TYPE=REPORT,
GRID=ON,
FONT='TIMES NEW ROMAN',
SIZE=10,
BACKCOLOR='NONE',
ENDSTYLE
END
Meanwhile: you posted your code without
[code]
[/code]
tags, so it's possible that some of your code got slightly mangled - particularly the SUBHEAD - I imagine each subhead has two lines - one blank and one with text.
A possible solution to your problem might be to add some bottom margin (BOTTOMMARGIN=0.30) because I think you're getting the first duplicate heading because of overflow and the second because of your ON statement. Adding the .3 bottom margin seems to eliminate the first duplicate.
In the past, when I worked with PDF output, I could control the number of lines per page with SET LINES=30, but this does not seem to work any more. Then, I've also seen LINES-PER-PAGE in the stylesheet, but I think this is/was for Active HTML. Nevertheless, I think your problem is because of overflow...
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