Focal Point
[SOLVED] subhead

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

August 17, 2006, 04:48 PM
lia
[SOLVED] subhead
how do i make a subhead repeat on the next page?

This message has been edited. Last edited by: FP Mod Chuck,
August 17, 2006, 05:38 PM
dwf
Lia,

That doesn't quite make sense. A subhead is intended to print each time there's a change in the value of the sort field with which the subhead is associated. Are you looking, perhaps, for a page heading? Or maybe you just want a page break every time you get a new subhead?


dwf
August 18, 2006, 08:31 AM
mgrackin
Lia,

As noted by "dwf", the SUBHEAD is only printed when the sort field value changes. If the sort field value change does not conincide with a page break, you won't get the SUBHEAD text to repeat on the next page.

A couple of suggestions would be:

1) Try using HEADING since this appears on every page which "dwf" noted.

2) You could try the NOSPLIT keyword which attempts to keep records for the same sort value on the same page. In other words, it tries to avoid doing a page break in the middle of a section. However, if you have 100 records for a section there is no way to avoid a page break in the section and therefore you are stuck with the same problem.

Wouldn't it be nice to be able to do an

ON PAGE SUBHEAD or SUBFOOT

Hmm, sounds like a new feature request.


Thanks!

Mickey

FOCUS/WebFOCUS 1990 - 2011
August 18, 2006, 09:22 AM
lia
I understand that the subhead is intented to print each time the value of a sort field changes. However there are times then the records under that subhead continues to the next page and I would like to be able to print the subhead again.
Thanks.
August 18, 2006, 09:54 AM
dwf
lia,

I won't say there's no way to do that, as I have done that sort of thing before, but there is no way that could remotely be described as straightforward. Mickey's suggestion to use NOSPLIT would be a few thousand times easier. Of course, if your sections tend to be a hundred lines long, that isn't going to help.

The only way I know to do what you want is to use Modify or Maintain to build a file that is constructed in a manner such that the TABLE FILE has almost no work to do. It is extremely involved, and it would be impossible to describe the procedure in any detail here, but essentially, you take the output of your current TABLE FILE (sans any formatting such as heading, subfoot, etc), SAVE it and run it through Modify or Maintain to create a FOCUS file. Along the way, you create a numeric field (call it S_HEAD, maybe) that increments at every point where you want a subhead. So for the first few records, it would be 1. At the point where you want a subhead, it changes to 2. Stays 2 until you need a another subhead, at which point it changes to 3. Etc. Note that this value might change when some sort value changes, or it might change when your line counter (which you are also calculating) reaches a predetermined value (50, 55, whatever). You TABLE FILE this file, PRINT fields by S_HEAD, ON S_HEAD SUBHEAD.

It's more involved that it probably sounds, and it is a lot of work. You have to want that repeated subhead pretty bad to undertake it.

Don't know if that helped, but it's the only idea I've got. Smiler


dwf
August 18, 2006, 09:56 AM
TexasStingray
lia, what you are asking does make sence. because I do it. I have a large amount of data and need the sub-head to reprint on the next page so that the user knows what the group is. Here is an example using ggsales.

  
TABLE FILE GGSALES
HEADING
"Page <TABPAGENO"
SUM
	DOLLARS
	BUDDOLLARS
AND COMPUTE ROWCNT/I9 = LAST ROWCNT + 1; NOPRINT

BY REGION NOPRINT
BY ST
BY CITY
BY STCD
BY PRODUCT
BY TOTAL ROWCNT NOPRINT

ON ROWCNT SUBHEAD
"Region: <REGION "
WHEN REGION NE LAST REGION OR TABPAGENO NE LAST TABPAGENO;

WHERE READLIMIT EQ 1000
ON TABLE SET STYLE *
     PAGESIZE='Letter',
     LEFTMARGIN=0.250000,
     RIGHTMARGIN=0.250000,
     TOPMARGIN=0.250000,
     BOTTOMMARGIN=0.250000,
     SQUEEZE=ON,
     ORIENTATION=PORTRAIT,
$
TYPE=REPORT,
     GRID=ON,
     FONT='TIMES NEW ROMAN',
     SIZE=10,
     BACKCOLOR='NONE',
     STYLE=NORMAL,
$
TYPE=SUBHEAD, BY=6, BACKCOLOR=YELLOW,$
ENDSTYLE
END





Scott

Texas,

Nice! But too danged easy Smiler


dwf
That's why I work for IBI. Because WebFOCUS Makes it easy.




Scott

Tex,

I like your solution. It works very nicely although, being one who is familiar with the internals of TABLE request processing, it makes me go bananas trying to think it through as to WHY it works.

The big secret here is that you are forcing a SUBHEAD on a COMPUTEd field which is sorted using the BY TOTAL statement. This is critical since the BY TOTAL is processed after all other sorting and aggregation. :s

Another thing that makes me flinch is the use of the OR on the WHEN clause. The WF 7.1 Reporting Manual does not document the fact that you can put multiple conditions in a WHEN phrase. Is this a hidden feature/7.1.x enhancement not yet documented?

The last thing that makes me nervous is the usage of TABPAGENO in the WHEN phrase. In the past I have tried to do things using the TABPAGENO field in calculations, etc. and have not been very successful. Again, I think it works in your case since you are forcing the SUBHEAD on the BY TOTAL COMPUTEd field.

All things considered, nice job! I will keep this in mind for future needs.


Thanks!

Mickey

FOCUS/WebFOCUS 1990 - 2011
Oh, Texas! You have too much coding knowledge to be in sales!


dwf
I do not know if this is a new feature in 7.1x I just started using it last month to accomplish this. As far as the Internals, I don't really know that much. I just work with a lots of customers and try to find ways to meet their needs. I have always said that there is nothing WebFOCUS/FOCUS cannot do it just make take some thinking. I am always glad to help out when I can. To Everyone using Focal Point GREAT JOB and keep it up, helping each other is what makes Focal Point Successful.




Scott

quote:
TexasStingray


Hi TexasStingray,
I have to display sub head in each and every page so i am using the "COMPUTE ROWCNT/I9 = LAST ROWCNT + 1; NOPRINT" logic as you mentioned in the above posts.

If the print data(customers name and address) is more then one single page then first page i am getting sub header and few customers, then next page it is printing next customer data and then sub head then customers.

I will submit a JCL to run this Focus program not from the webfocus and PDF format.

is there any way to print sub head then customers in all pages?
Jagan -

I would suggest NOSPLIT to prevent orphaned detail lines.

-- but NOSPLIT does not mix with BY TOTAL:

(FOC1959) NOSPLIT option is not supported in this request
NOSPLIT and BY TOTAL can not be used in the same request

The solution is to HOLD the data, including the computed ROWCNT, and then report from HOLD using NOSPLIT (without BY TOTAL) -- as below.



Separately, you can distinguish a "sort-break" subhead from a "page-break" one:

ON ROWCNT SUBHEAD
"Region: WHEN REGION NE LAST REGION;

ON ROWCNT SUBHEAD
"Region: WHEN REGION EQ LAST REGION AND TABPAGENO NE LAST TABPAGENO;




  
TABLE FILE GGSALES
SUM
	DOLLARS
	BUDDOLLARS
AND COMPUTE ROWCNT/I9 = LAST ROWCNT + 1; NOPRINT

BY REGION 
BY ST
BY CITY 
BY STCD 
BY PRO

WHERE READLIMIT EQ 1000
ON TABLE HOLD
END

TABLE FILE HOLD
HEADING
"Page <TABPAGENO"
SUM
	DOLLARS
	BUDDOLLARS
ROWCNT NOPRINT

BY REGION NOPRINT
BY ST
BY CITY 
BY STCD NOSPLIT
BY PRODUCT
BY ROWCNT NOPRINT

ON ROWCNT SUBHEAD
"Region: <REGION "
WHEN REGION NE LAST REGION 

ON ROWCNT SUBHEAD
"Region: <REGION| (continued)"
WHEN REGION EQ LAST REGION AND TABPAGENO NE LAST TABPAGENO;

ON TABLE SET STYLE *
[as before]
ENDSTYLE
ON TABLE PCHOLD FORMAT PDF
END



- Jack Gross
WF through 8.1.05
Hi All,

Here is my code along with sample data and report format.

**************
TABLE FILE ABC
SUM
COMPUTE TOTALS_MAIN/D10.2M = TOT_PYMT_MAIN; NOPRINT
BY MAINDEPTNO AS '' NOPRINT

SUM
COMPUTE TOTALS_SUB/D10.2M = TOT_PYMT_SUB; NOPRINT
BY MAINDEPTNO AS '' NOPRINT
BY SUBDEPTNO AS '' NOPRINT

HEADING
"DEPARTMENT DETAILS <120 PAGE NO: <TABPAGENO"
""
" MAIN DEPT NUMBER <22 <MAINDEPTNO <40 TOTAL PAYMENTS <TOTALS_MAIN"
""
""
PRINT
EMPLOYEE_NO NOPRINT
AND COMPUTE ROWCNT/I9 = LAST ROWCNT + 1; NOPRINT
BY MAINDEPTNO AS '' NOPRINT
BY SUBDEPTNO AS '' NOPRINT PAGE-BREAK REPAGE
BY TOTAL ROWCNT NOPRINT
BY EMPLOYEE_NAME NOPRINT
ON EMPLOYEE_NAME SUBHEAD
""
"<1<EMPLOYEE_NO <16<EMPLOYEE_NAME <30 <EMPLOYEE_COURSE_NAME"
" <16<EMPLOYEE_ADDRESS"
" <16<EMPLOYEE_CITY <EMPLOYEE_STATE < EMPLOYEE_ZIP_CODE"

ON ROWCNT SUBHEAD
"SUB DEPT NUMBER <22 <SUBDEPTNO <40 SUB DEPT PAYMENTS: <TOTALS_SUB"
"NAME <SUBDEPT_NAME "
"ADDRESS <SUBDEPT_ADR "
" <SUBDEPT_CITY , <SUBDEPT_STATE <SUBDEPT_ZIP "
""
"EMPLOYEE NUMBER <16 EMPLOYEE NAME & ADDRESS <30 EMPLOYEE COURSE NAME"
""
WHEN SUBDEPTNO NE LAST SUBDEPTNO OR TABPAGENO NE LAST TABPAGENO;


**************

100100EMP1
100100EMP2
100101EMP1
100101EMP2
100102EMP1
100102EMP2
100102EMP3
100102EMP4
100102EMP5
100102EMP6

******** Actual report format *******

page: 1
Main department no : 100
Sub department no : 100
emp1
emp2

page: 1
Main department no : 100
Sub department no : 101
emp1
emp2

page:1
Main department no : 100
Sub department no : 102
emp1
emp2
emp3

page:2
Main department no : 100
Sub department no : 102
emp4
emp5
emp6

**********************


******** Report format displaed by my program *******

page: 1
Main department no : 100
Sub department no : 100
emp1
emp2

page: 1
Main department no : 100
Sub department no : 101
emp1
emp2

page:1
Main department no : 100
Sub department no : 102
emp1
emp2
emp3

page:2
Main department no : 100
emp4
Sub department no : 102
emp5
emp6

**********************



Actually I want to display employees in Main Department and also in each sub departments.

Main Department number should be displayed in My Header part and sub heading must display the sub department number.

If the main departmet has employees then I am displaying the main department number in sub heading also.


Problem:

For example If I have 10 employees, 7 are getting displayed in first page. In the next page, 8th employee details are displayed before the subhead and then the remaining records.This process repeats in all the subsequent pages.

I am executing Focus program by submitting a JCL which will inturn send report data to mainframe printer.

Please let me know how to make sub head appear before the employee details for each page ?
let me know if any code change is required ?

This message has been edited. Last edited by: <Jagan>,
Hi Jagan,

can you please share the solution as I am getting same issue in pdf layout.

Thanks in Advance


WebFocus 8104,8204
Excel/PDF/HTML/HTMLTABLE/XML/ALPHA/GIF file/GRAPH/Active technologies
Neelima

This post is 10 years old I suggest you open a case as chances are Jagan is no longer around.


Thank you for using Focal Point!

Chuck Wolff - Focal Point Moderator
WebFOCUS 7x and 8x, Windows, Linux All output Formats
Thanks Chuck!!


WebFocus 8104,8204
Excel/PDF/HTML/HTMLTABLE/XML/ALPHA/GIF file/GRAPH/Active technologies
Please try this , slightly different from your requirement but it will print previous page's subhead details in heading of next page .
 
TABLE FILE WF_RETAIL
SUM 
     COGS_US
     COGS_LOCAL
BY  LOWEST PRODUCT_SUBCATEG
BY  LOWEST PRODUCT_CATEGORY
BY  MODEL
     
ON PRODUCT_CATEGORY SUBHEAD
"<PRODUCT_CATEGORY "
" "
"<PRODUCT_SUBCATEG "
HEADING
"<PRODUCT_CATEGORY "
" "
"<PRODUCT_SUBCATEG "
WHEN TABPAGENO NE LAST TABPAGENO AND PRODUCT_SUBCATEG EQ LAST PRODUCT_SUBCATEG
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE SET ASNAMES ON
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT PDF
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
     INCLUDE = IBFS:/EDA/EDASERVE/_EDAHOME/ETC/warm.sty,
$
TYPE=HEADING,
     COLOR=RGB(75 75 75),
     BACKCOLOR='SILVER',
     STYLE=BOLD,
     JUSTIFY=LEFT,
$
TYPE=HEADING,
     LINE=1,
     OBJECT=TEXT,
     ITEM=1,
     FONT='IBIDEFAULT',
     SIZE=9,
$
TYPE=HEADING,
     LINE=1,
     OBJECT=FIELD,
     ITEM=1,
     FONT='IBIDEFAULT',
     SIZE=9,
$
TYPE=HEADING,
     LINE=2,
     OBJECT=TEXT,
     ITEM=1,
     FONT='IBIDEFAULT',
     SIZE=9,
$
TYPE=HEADING,
     LINE=3,
     OBJECT=TEXT,
     ITEM=1,
     FONT='IBIDEFAULT',
     SIZE=9,
$
TYPE=HEADING,
     LINE=3,
     OBJECT=FIELD,
     ITEM=1,
     FONT='IBIDEFAULT',
     SIZE=9,
$

TYPE=SUBHEAD,
     COLOR=RGB(75 75 75),
     BACKCOLOR='SILVER',
     STYLE=BOLD,
     JUSTIFY=LEFT,
$
TYPE=SUBHEAD,
     LINE=1,
     OBJECT=TEXT,
     ITEM=1,
     FONT='IBIDEFAULT',
     SIZE=9,
$
TYPE=SUBHEAD,
     LINE=1,
     OBJECT=FIELD,
     ITEM=1,
     FONT='IBIDEFAULT',
     SIZE=9,
$
TYPE=SUBHEAD,
     LINE=2,
     OBJECT=TEXT,
     ITEM=1,
     FONT='IBIDEFAULT',
     SIZE=9,
$
TYPE=SUBHEAD,
     LINE=3,
     OBJECT=TEXT,
     ITEM=1,
     FONT='IBIDEFAULT',
     SIZE=9,
$
TYPE=SUBHEAD,
     LINE=3,
     OBJECT=FIELD,
     ITEM=1,
     FONT='IBIDEFAULT',
     SIZE=9,
$


ENDSTYLE
END
    
  



WF Production :- WF:8.0.0.4, 8.1.05 App-studio/Developer Studio(8.1.x) ,
8.2.0.1M , 8.2.0.2 (App-Studio8.2.x),
InfoAssist/+, InfoDiscovery
Output format:-AHTML, PDF, Excel, HTML
Platform:-Windows 7, 8,10
my dear friend "Chaudhary", I am able to get subhead in next page but I am having one issue( getting detail row above subhead).

Above code is already available on Existing threads.

Thanks for your help.. :-)


WebFocus 8104,8204
Excel/PDF/HTML/HTMLTABLE/XML/ALPHA/GIF file/GRAPH/Active technologies