Focal Point
[SOLVED] Printing in alternate pages in HTML format

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

January 12, 2009, 09:49 AM
T.N.V.Pandian
[SOLVED] Printing in alternate pages in HTML format
Hi,
I want the contents of the hold file should be printed in alternate pages i.e. 1,3,5. Is it possible to achieve it.
Thanks in advance.

TNVP.



WebFOCUS 7.1.4,Linux,
HTML,PDF,Excel,CSV

This message has been edited. Last edited by: T.N.V.Pandian,
January 12, 2009, 12:09 PM
Darin Lee
What do you mean by "printed". By definition, hold files are not printed, so there's some other piece in there that is retrieving the records and outputting them to HTML, PDF, Excel, etc.


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
January 13, 2009, 12:43 AM
T.N.V.Pandian
Darin,
Thank you for showing interest in my issue.Please have a look at the following code.

 

TABLE FILE CAR
PRINT COUNTRY 
CAR
ON TABLE HOLD
END

TABLE FILE HOLD
PRINT *
END
    


I have some data in hold file.By using the above code,the data get displayed in consecutive pages(Page no 1,2,3,4....).But,I want the data to be displayed in alternate pages(Page no 1,3,5,....).

Thanks,
TNVP



WebFOCUS 7.1.4,Linux,
HTML,PDF,Excel,CSV

This message has been edited. Last edited by: T.N.V.Pandian,
January 13, 2009, 04:37 AM
<JG>
This will do it for HTML

 TABLE FILE CAR
LIST COUNTRY 
CAR
ON TABLE HOLD
END
-RUN
SET LINES=10
-RUN
SET PAGE=NOPAGE
DEFINE FILE HOLD
PB/A100='<p style="page-break-before: always">';
XNUM/I9 =;
ODDPAGE/I9= IF LIST EQ 1 THEN 1 ELSE IF IMOD(E01,2,XNUM) EQ 1 THEN LAST ODDPAGE + 2 ELSE LAST ODDPAGE;
EVENPAGE/I9= ODDPAGE +1;
END
TABLE FILE HOLD
"PAGE  <ODDPAGE "
PRINT COUNTRY 
CAR 

FOOTING BOTTOM
"<PB PAGE  <EVENPAGE "
" "
"<PB "
END 

January 13, 2009, 07:43 AM
T.N.V.Pandian
JG,
Thanks for your valuable suggestion.It is working fine.But my requirement is as follows. I have data in two hold files.I want the data in hold file-1 to be displayed in page.no 1,3,5.. and data in hold file-2 to be displayed in page no 2,4,6..
One important thing is the number of coulmns in those two hold files are not equal.

Is it possible to achieve it.

Thanks in advance,
TNVP



WebFOCUS 7.1.4,Linux,
HTML,PDF,Excel,CSV
January 13, 2009, 08:02 AM
<JG>
That's a very different thing

The following will do what you want but it is unstyled

DATALINE which in my example is A40 should be the maximum total length of
the longest record


TABLE FILE CAR
LIST COUNTRY
CAR DEALER_COST RETAIL_COST
ON TABLE HOLD
END
-RUN
SET LINES=10
-RUN
SET PAGE=NOPAGE
FILEDEF PRINTFILE DISK PRINTFILE.FTM (APPEND
DEFINE FILE HOLD
ODDPAGE/I9= IF LIST EQ 1 THEN 1 ELSE IF IMOD(E01,2,'I9') EQ 1 THEN LAST ODDPAGE + 2 ELSE LAST ODDPAGE;
EVENPAGE/I9= ODDPAGE +1;
END
TABLE FILE HOLD
PRINT COUNTRY
CAR
BY ODDPAGE
BY E01
ON TABLE HOLD AS PRINTFILE FORMAT ALPHA
END
-RUN
TABLE FILE HOLD
PRINT COUNTRY
CAR
DEALER_COST RETAIL_COST
BY EVENPAGE
BY E01
ON TABLE HOLD AS PRINTFILE FORMAT ALPHA
END
-RUN
!DEL PRINTFILE.MAS
FILEDEF MASFILE DISK PRINTFILE.MAS (APPEND
-RUN
-WRITE MASFILE FILENAME=PRINTFILE, SUFFIX=FIX , $
-WRITE MASFILE SEGMENT=PRINTFIL, SEGTYPE=S2, $
-WRITE MASFILE FIELDNAME=PAGE, ALIAS=E01, USAGE=I9, ACTUAL=A09, $
-WRITE MASFILE FIELDNAME=LIST, ALIAS=E02, USAGE=I5, ACTUAL=A05, $
-WRITE MASFILE FIELDNAME=DATALINE, ALIAS=E03, USAGE=A40, ACTUAL=A40, $
-*
TABLE FILE PRINTFILE
PRINT DATALINE
BY PAGE PAGE-BREAK
BY E02
END
January 13, 2009, 10:55 AM
<JG>
quote:
ODDPAGE/I9= IF LIST EQ 1 THEN 1 ELSE IF IMOD(E01,2,'I9') EQ 1 THEN LAST ODDPAGE + 2 ELSE LAST ODDPAGE;


I should have said the 2 should equal the number of lines of data on each page
January 13, 2009, 04:09 PM
Waz
If the output is PDF, you could do this with a compound report.

If you had 7.6.x you could use a coordinated compound report.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

January 13, 2009, 05:09 PM
Darin Lee
I thought of the compound doc as well, but since you're generating each page as its own report, you would have to come up with some mechanism to tell you which record was the last one printed on the last odd-(or even-) numbered page to continue with the next page of the report. It could probably be done, but it seems like a very long way around to accomplish something that doesn't make much sense to me. (Yeah, I know - they're all just user requests regardless of how strange!)

I just cannot come up with a practical application for this requirement. It would be like combining two books into one - all the pages from book one show up on the left side of the page, all the pages from book two show up on the right. There would be no continuous flow when you read it so you would be skipping pages anyway. Just show everything that belongs to report one and THEN show everything that belongs to report two. And save yourself some time.


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
January 13, 2009, 08:53 PM
Waz
If you are going to use a compound report, you will have to determine what record is on what page.

If the report is styled, does it have SUBHEAD/FOOTs or WHEN clauses, this will make it very difficult.

It can be done, I did it with one report once. A lot of calculations.

The only other option that I can think of is to save the HTML reports and post process them, determining the page blocks and then merging the two reports, very difficult.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

January 13, 2009, 09:11 PM
Mika Keranen
Hi,

Would the code below help? It should work as is in HTML and with PDF, you don't need the PB field and FOOTING, but instead the &option and FORMAT lines. Of course, the "page number" works correctly only if each report fits to one page.

Thanks to JG for the PB defintion.

Regards,
Mika

  
SET PAGE = NOPAGE
SET HOLDLIST = PRINTONLY
-* Odd pages.
TABLE FILE CAR
SUM SALES
COMPUTE CNTR/I3 = IF COUNTRY NE LAST COUNTRY THEN CNTR + 2 ELSE CNTR ; NOPRINT
COMPUTE PAGENO/I3 = CNTR - 1 ;
BY COUNTRY
BY CAR
BY MODEL
ON TABLE HOLD AS RPT1
END
-RUN 
-* Even pages.
TABLE FILE CAR
SUM SALES RETAIL_COST DEALER_COST
COMPUTE PAGENO/I3 = IF COUNTRY NE LAST COUNTRY THEN PAGENO + 2 ELSE PAGENO ;
BY COUNTRY
BY CAR
BY MODEL
ON TABLE HOLD AS RPT2
END
-RUN 
-* Max. page no.
TABLE FILE RPT2
SUM MAX.PAGENO
ON TABLE SAVE
END
-RUN
-READ SAVE &maxPage.A3.
-TYPE &maxPage
-REPEAT :doLoop FOR &ind FROM 1 TO &maxPage
-SET &XFile = IF IMOD(&ind,2,'I2') EQ 0 THEN 'RPT2' ELSE 'RPT1' ;
-*
-*-SET &option = IF &ind EQ 1 THEN 'OPEN' ELSE
-*-              IF &ind EQ &maxPage THEN 'CLOSE' ELSE '' ;

DEFINE FILE &XFile
PB/A100='<p style="page-break-before: always">';
END

TABLE FILE &XFile
PRINT *
WHERE PAGENO EQ &ind ;
HEADING
"Data file : &XFile"
"Page &ind"
" "
-IF &ind EQ &maxPage THEN GOTO :noFOOT ;
FOOTING
"<PB"
-:noFOOT

-*ON TABLE PCHOLD FORMAT PDF &option

ON TABLE SET STYLE *
TYPE=REPORT, SQUEEZE=ON, FONT=ARIAL, SIZE=9, $
ENDSTYLE
END
-RUN
-:doLoop



WebFOCUS 7.6.x
PMF 5.2.x
January 14, 2009, 12:58 PM
Darin Lee
That's a good idea Mika, but as you mention, if any one of those sections of the report happen to span more than one page (which would be likely for anything except the car file), I think that breaks the whole thing.

As Waz mentions, any other solution is going to involve a ton of calculations and a lot of difficulty. My solution would be to rethink the layout of your output. There's got to be a better way than what you're proposing.


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
January 14, 2009, 04:04 PM
Waz
Its a pity that the report output is HTML, I just remembered, that I did this exact thing @#$% years ago with WP format, much simpler as the output is relatively fixed and known.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

January 14, 2009, 04:38 PM
FrankDutch
I can think of a functional use of this issue.
A report with more columns than you can handle on a page you might want to split it over two pages, where the rows are on both opposite pages are the same. (remember to start on page 2...) and print on the front and back site.
(or use A3 instead of A4)
If you know how many reporting lines you can have by page you can calculate the page numbers and print the fields on the odd or even pages depending on that page number.

I wonder if you can use the WHEN statement in this situation.

Can you suppress a column based on this??




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

January 19, 2009, 02:11 AM
T.N.V.Pandian
Hi,

Thanks Darin,JG,Waz,Mika,Frank for your valuable suggestions.Mika's code helps us to meet the requirement.Having it as a reference ,we are working to achieve the exact requirement.

Frank, the functional use you said is exactly same as the one what we want.We are working on it.


Thank you once again.

TNVP



WebFOCUS 7.1.4,Linux,
HTML,PDF,Excel,CSV

This message has been edited. Last edited by: T.N.V.Pandian,
January 19, 2009, 02:57 AM
FrankDutch
TNVP

did you ever try this code

ON TABLE SET BYPANEL ON ?

TABLE FILE CAR
PRINT 
     MODEL
     BODYTYPE
     SEATS
     DEALER_COST
     RETAIL_COST
     SALES
     LENGTH
     WIDTH
     HEIGHT
     WEIGHT
     WHEELBASE
     FUEL_CAP
     BHP
     RPM
     MPG
     ACCEL
BY COUNTRY
BY CAR
ON TABLE SUBHEAD
""
ON TABLE SUBFOOT
""
ON TABLE SET BYPANEL ON
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT PDF
ON TABLE SET HTMLCSS ON


This will exactly do what you (we) need....

I was thinking that your problem should / would have been solved already.




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

January 19, 2009, 04:29 AM
T.N.V.Pandian
Frank,
Thanks.The code you gave is working fine in PDF but not with HTML.We need the output in HTML.

Thanks.
TNVP



WebFOCUS 7.1.4,Linux,
HTML,PDF,Excel,CSV