Focal Point
[SOLVED] PDF Letter

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

March 14, 2007, 01:56 PM
Tracie Jones
[SOLVED] PDF Letter
I am trying to produce a double pledge reminder in PDF on a two fold preforated page. The top half will show one record and the bottom half will show the next record. So far I have put the letter verbage and pulled the fields into the header. What do I do to print the next record on the bottom half? I tried putting the exact same thing in the footer, but the footer skips about 4 records and then displays the 5th record. Don't know why......Thanks!

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


tbj
Prod WF 8.1.05,Test WF 8.1.05, WINDOWS 7 Platform, Oracle 12
Excel, PDF, Alpha
March 14, 2007, 02:15 PM
mgrackin
Tracie,

I would use a SUBHEAD instead of HEADING and FOOTING on the BY field that allows you to differentiate between record 1 and record 2. Without knowing your data it is a bit hard to give more details.


Thanks!

Mickey

FOCUS/WebFOCUS 1990 - 2011
March 14, 2007, 02:56 PM
Danny-SRL
Tracie,

If you want 2 records on 1 page, you could try and set the page size to the actual size of the half page.
Another possibility is to reformat your data into a new file and have in one record of the new file the data from 2 records of the old file. Here is a small example:
DEFINE FILE CAR
RW/I1 WITH CAR=IF LAST RW EQ 0 THEN 1 ELSE 0;
CL/I5 WITH CAR=IF RW EQ 0 THEN LAST CL ELSE LAST CL + 1;
END
TABLE FILE CAR
SUM CAR SALES
BY CL NOPRINT
ACROSS HIGHEST RW NOPRINT
END


Daniel
In Focus since 1982
wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF

March 14, 2007, 03:20 PM
Alan B
Tracie

I have to do 3 up labels, on pre-printed stationery and now swear by the PDF compund report.

Basically you do have to run 2 reports, but this could be/should be from a hold file. Set up a compound report like this:
-* File TEST81.fex
-********************** PUT CODE FOR HOLD FILE HERE IF REQUIRED
-* Default Mode: ResourceLayout
COMPOUND LAYOUT
UNITS=IN, $
SECTION=section1, LAYOUT=ON, MERGE=OFF, ORIENTATION=PORTRAIT, PAGESIZE=Letter, $
pagelayout=1, name='Layout page 1', $
component='report1', type=report, position=(0.520 0.837), dimension=(7.583 5.000), $
component='report2', type=report, position=(0.500 6.083), dimension=(7.583 5.000), $
END
SET COMPONENT='report1'
-*component_type report
-SET &CNTR=1;
-INCLUDE TEST80
SET COMPONENT='report2'
-*component_type report
-SET &CNTR=2;
-INCLUDE TEST80
COMPOUND END

this has basically split your page into 2 sections, with a report in each section. The report code splits the data into 2 with a CNT field in the report, screened on &CNTR. The layout and position can be adjusted to suit your requirements. This report can be run of a hold file if you want to, put the code to create teh hold file where I commented above. The report code:
SET PAGE=NOPAGE
DEFINE FILE CAR
CNTR/I1 WITH LENGTH = IF CNTR EQ 1 THEN 2 ELSE 1;
END
TABLE FILE CAR
PRINT
     BODYTYPE AS ''
     LENGTH AS ''
     WIDTH AS ''
     HEIGHT AS ''
     WEIGHT AS ''
     CNTR AS ''
BY COUNTRY NOPRINT
BY CAR NOPRINT
BY MODEL NOPRINT
ON MODEL PAGE-BREAK
HEADING
"<COUNTRY <CAR <MODEL "
IF CNTR EQ &CNTR
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT PDF
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
     UNITS=IN,
     SQUEEZE=ON,
     ORIENTATION=PORTRAIT,
$
TYPE=REPORT,
     GRID=OFF,
     FONT='ARIAL',
     SIZE=10,
     COLOR='BLACK',
     BACKCOLOR='NONE',
     STYLE=NORMAL,
$
ENDSTYLE
END

so records with a CNTR of 1 will go on the top of teh page, and records with a CNTR of 2 on the bottom half of the page.

This is just a basic example, but I use the full version succesfully for 3 up, 100 page PDF files, with greast precision of the output layout.


Alan.
WF 7.705/8.007
March 14, 2007, 03:35 PM
Darin Lee
Quickest way is just to set pagesize to "Statement" and Landscape and then page break by record number. You can do all this in the GUI


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
March 14, 2007, 04:22 PM
Alan B
Darin

Except that you cannot print this document out correctly.


Alan.
WF 7.705/8.007
March 15, 2007, 09:13 AM
Danny-SRL
Tracie,

I don't know if your problem was solved. I have developped my proposal for having 2 records in one page. I hope it can help you.

DEFINE FILE CAR
RW/I1 WITH CAR=IF LAST RW EQ 0 THEN 1 ELSE 0;
CL/I5 WITH CAR=IF RW EQ 0 THEN LAST CL ELSE LAST CL + 1;
END
TABLE FILE CAR
SUM CAR SALES DEALER_COST RETAIL_COST COMPUTE PROFIT/D7=RETAIL - DEALER;
BY CL
ACROSS HIGHEST RW
ON TABLE SET ASNAMES ON
ON TABLE HOLD
END
TABLE FILE HOLD
BY CL NOPRINT PAGE-BREAK SUBHEAD
-SET &CTR=1;
-REPEAT #LOOP 2 TIMES;
" "
"Dear <CAR&CTR "
"We are pleased to inform you of the sale of <SAL&CTR units"
"Purchase price was <DEA1 and sale price <RET&CTR "
"giving yo a profit of <PRO&CTR "
" "
"With best regards, "
"John Doe, Service Manager"
"</18 "
-IF &CTR EQ 0 GOTO #LOOP;
"----------------------------------------------------------------------"
-SET &CTR=0;
-#LOOP
ON TABLE SET PAGE OFF
ON TABLE PCHOLD FORMAT PDF
END


I put in the dotted line to show where the perforation is. Of course it does not have to be printed.
The /18 spot marker is a guess about the postion of the physical perforation.

Good luck!


Daniel
In Focus since 1982
wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF

March 15, 2007, 02:39 PM
Tracie Jones
LOL, mgrackin was right....I just used subhead, kept my code in the header and footer and it worked....WOW


tbj
Prod WF 8.1.05,Test WF 8.1.05, WINDOWS 7 Platform, Oracle 12
Excel, PDF, Alpha
March 15, 2007, 03:17 PM
Tracie Jones
ok, MY bad that doesn't work...That is printing the same record in the footer and in the next header on the next page.....thats sucks...

I tried the other 2 ways listed above from Daren and Danny but something is not right...it takes toooooo long to run....

Stay tuned...


tbj
Prod WF 8.1.05,Test WF 8.1.05, WINDOWS 7 Platform, Oracle 12
Excel, PDF, Alpha
March 15, 2007, 03:26 PM
Alan B
That's why I use the compound report. Works every time.


Alan.
WF 7.705/8.007
March 15, 2007, 03:29 PM
Tracie Jones
Oh, yeah Alan, I meant to say I tried yours....its taking too long to run....Do I put that COMPOUND LAYOUT code under the final report?


tbj
Prod WF 8.1.05,Test WF 8.1.05, WINDOWS 7 Platform, Oracle 12
Excel, PDF, Alpha
March 15, 2007, 03:54 PM
Alan B
Tracie

I extract the required data into a hold file at the top, then run the formatted reports off the hold file with the requests at the -INCLUDE point.

How much data are you using? I get sub 2 seconds for 100 pages to run on the server (and the server is tiny and db large), plus the time taken to download the PDF to the user which I cannot control.


Alan.
WF 7.705/8.007
March 15, 2007, 04:20 PM
Tracie Jones
Its about 600 records, so 300 PDF pages....I will look at my code again. I think I did something wrong.


tbj
Prod WF 8.1.05,Test WF 8.1.05, WINDOWS 7 Platform, Oracle 12
Excel, PDF, Alpha
March 15, 2007, 05:00 PM
Alan B
Let us know your progress. If I can help, let me know.


Alan.
WF 7.705/8.007
March 15, 2007, 06:32 PM
Tracie Jones
Hi Alan I am still confused on the order of each piece. I have my hold file. I format the letter off the hold file and this is the point where I put the compount code right? I don't understand what the include consists of. This is all one report but is it suppose to be 2?


tbj
Prod WF 8.1.05,Test WF 8.1.05, WINDOWS 7 Platform, Oracle 12
Excel, PDF, Alpha
March 15, 2007, 06:42 PM
Alan B
Tracie

Create a hold file first. This should then be used in the focexec that you call within the -INCLUDE, in my case TEST80. Yes, it is the same report, but using the &variable &CNTR, set to 1 for the first run and 2 for the second run. The TEST80 focexec has a define on a PRINT field with a CNTR. This sets alterante records to a value of 1 or 2, this DEFINEd field, CNTR is then screened against &CNTR. The effect of this is that records allocated number 1 in the CNTR are in the first run, at the top of the page and records allocated number 2 are in the second run at the bottom of the page.

The compound report code:
-* File TEST81.fex
TABLE FILE CAR
PRINT....
.
.
.
ON TABLE HOLD
END
-* Default Mode: ResourceLayout
COMPOUND LAYOUT
UNITS=IN, $
SECTION=section1, LAYOUT=ON, MERGE=OFF, ORIENTATION=PORTRAIT, PAGESIZE=Letter, $
pagelayout=1, name='Layout page 1', $
component='report1', type=report, position=(0.520 0.837), dimension=(7.583 5.000), $
component='report2', type=report, position=(0.500 6.083), dimension=(7.583 5.000), $
END
SET COMPONENT='report1'
-*component_type report
-SET &CNTR=1;
-INCLUDE TEST80
SET COMPONENT='report2'
-*component_type report
-SET &CNTR=2;
-INCLUDE TEST80
COMPOUND END

The report code, test80.fex:
SET PAGE=NOPAGE
DEFINE FILE HOLD
CNTR/I1 WITH LENGTH = IF CNTR EQ 1 THEN 2 ELSE 1;
END
TABLE FILE HOLD
PRINT
     BODYTYPE AS ''
     LENGTH AS ''
     WIDTH AS ''
     HEIGHT AS ''
     WEIGHT AS ''
     CNTR AS ''
BY COUNTRY NOPRINT
BY CAR NOPRINT
BY MODEL NOPRINT
ON MODEL PAGE-BREAK
HEADING
"<COUNTRY <CAR <MODEL "
IF CNTR EQ &CNTR
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT PDF
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
     UNITS=IN,
     SQUEEZE=ON,
     ORIENTATION=PORTRAIT,
$
TYPE=REPORT,
     GRID=OFF,
     FONT='ARIAL',
     SIZE=10,
     COLOR='BLACK',
     BACKCOLOR='NONE',
     STYLE=NORMAL,
$
ENDSTYLE
END

Hope this calrifies things for you.


Alan.
WF 7.705/8.007
March 15, 2007, 06:52 PM
Tracie Jones
Why are you using both test 80 and test 81? these are 2 different fexes? How is that possible if its the same report? I have one fex.....


tbj
Prod WF 8.1.05,Test WF 8.1.05, WINDOWS 7 Platform, Oracle 12
Excel, PDF, Alpha
March 15, 2007, 06:57 PM
Alan B
The Compound report is called test81.fex, which is the procedure you call. This has the code to create your hold file, and -INCLUDEs the layout report test80.fex, which is the report, from the HOLD file, to place the data on the page.


Alan.
WF 7.705/8.007
March 15, 2007, 07:00 PM
Tracie Jones
so it is 2 reports...gotcha...


tbj
Prod WF 8.1.05,Test WF 8.1.05, WINDOWS 7 Platform, Oracle 12
Excel, PDF, Alpha
March 15, 2007, 07:21 PM
Tracie Jones
IT WORKED! THERE IS JUST A BLANK PAGE BETWEEN EACH PAGE. ANY SUGGESTIONS ON HOW TO REMOVE IT? THANKS SO MUCH FOR HELPING ME!


tbj
Prod WF 8.1.05,Test WF 8.1.05, WINDOWS 7 Platform, Oracle 12
Excel, PDF, Alpha
March 15, 2007, 07:29 PM
Alan B
Great.

Check the layout
  
COMPOUND LAYOUT
UNITS=IN, $
SECTION=section1, LAYOUT=ON, MERGE=OFF, ORIENTATION=PORTRAIT, PAGESIZE=Letter, $
pagelayout=1, name='Layout page 1', $
component='report1', type=report, position=(0.520 0.837), dimension=(7.583 5.000), $
component='report2', type=report, position=(0.500 6.083), dimension=(7.583 5.000), $
END

Position is in order (left top), and dimension (width height), it could be that the second component is hanging over from one page to the next. Reduce the height until it starts to cut off your report, and then increase a little. You do have to play with it a little bit.


Alan.
WF 7.705/8.007
March 15, 2007, 07:39 PM
Tracie Jones
The layout is as tight as it can be. There must be something else causing the extra page.


tbj
Prod WF 8.1.05,Test WF 8.1.05, WINDOWS 7 Platform, Oracle 12
Excel, PDF, Alpha
March 15, 2007, 07:59 PM
Alan B
It could be your report running outside these dimensions then. Try setting TOPMARGIN, BOTTOMMARGIN, TOPGAP and BOTTOMGAP etc. and playing with your layout a bit. It really is a question of going back until it page breaks as you want it to.


Alan.
WF 7.705/8.007
March 16, 2007, 02:17 PM
Tracie Jones
I got it working! Thanks so much Alan!


tbj
Prod WF 8.1.05,Test WF 8.1.05, WINDOWS 7 Platform, Oracle 12
Excel, PDF, Alpha
March 16, 2007, 02:25 PM
Alan B
No problem at all, I'm happy that you got a working result.


Alan.
WF 7.705/8.007
July 27, 2009, 10:53 AM
Tracie Jones
Danny, How do you just change the pagesize to 8.5 by 5.5 so I can change the page size of my document to fit 2 on a page. My issue now is making sure the address is static for each report on the single page.


tbj
Prod WF 8.1.05,Test WF 8.1.05, WINDOWS 7 Platform, Oracle 12
Excel, PDF, Alpha