Focal Point
[SOLVED] Number of Copies

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

November 03, 2008, 01:39 PM
TimpyJane
[SOLVED] Number of Copies
I'm unable to get the search function for the forums to work, and need a little help. I am creating a report that when printed needs to print two copies per record.

1) where do I go to set up the job to print two copies without user intervention?
2) How can I print two copies of the same record before printing the next record?

Thank you so much

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


Web Focus Developer Studio Release 7.6.1 Output formats include Excel, PDF, HTML, XML.
November 03, 2008, 01:55 PM
susannah
Please update your signature so we know what version and what platform you're on.

1) print 2 copies of a what? a report?, is it PDF or HTML?

2) 2 records for every 1 record in the database? or 2 copies of a report? same question, essentially.
You'll need to carefully state exactly what you need, before we can point you.
-s




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
November 03, 2008, 01:56 PM
Prarie
Wonder Why the Search Function Not Available?
November 03, 2008, 02:46 PM
Darin Lee
Search tab works fine for me. Try searching on "MacGuyver." This is a commonly used technique for multiplying rows of data. It could be used for making two rows out of one or two reports out of one, depending on where you create and break on sort values.


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
November 03, 2008, 02:53 PM
GinnyJakes
Another way that noone uses too much anymore is to print the same data n times across a made-up counter, hold it, then use an alternate master with an occurs to do the report.


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
November 03, 2008, 04:14 PM
TimpyJane
quote:
Originally posted by susannah:
Please update your signature so we know what version and what platform you're on.

1) print 2 copies of a what? a report?, is it PDF or HTML? PDF

Example: I have a list of 10 serial numbers. I have one form. I want to print two copies of the form for each serial, but I don't want to set the # of copies needed from the printer screen each time. I want to put this to code in the job.

WebFocus Developer Studio 7.1.4

Thanks
-s



Web Focus Developer Studio Release 7.6.1 Output formats include Excel, PDF, HTML, XML.
November 03, 2008, 04:17 PM
susannah
same question.....
is it html or pdf???




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
November 03, 2008, 04:24 PM
GinnyJakes
Timpy,

You have been given 2 workable solutions. Please let us know which one you want to pursue and what kind of additional information you need.

You can search the Advanced link above for information on MacGuyver.


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
November 21, 2008, 12:44 PM
TimpyJane
Both of these workable solutions are beyond my capabilities as I am just learning. Can I get an example of a made-up counter? Thanks


Web Focus Developer Studio Release 7.6.1 Output formats include Excel, PDF, HTML, XML.
November 21, 2008, 01:45 PM
GinnyJakes
Either MacGuyver or this should work for you. I will give you an example of using an alternate master with an OCCURS. Let's suppose that you have you have to print SERIAL, LASTNAME, FIRSTNAME, TELEPHONE on your form. And you need to do it twice and I'm going to leave the formatting up to you. First you start by duplicating the data such that it looks the same in a single row of a hold file.

DEFINE FILE filename
CNTR1/I1=1;
CNTR2/I1=2;
ROWCNTR/I4=ROWCNTR+1;
END
TABLE FILE filename
PRINT CNTR1 LASTNAME FIRSTNAME TELEPHONE
      CNTR2 LASTNAME FIRSTNAME TELEPHONE
BY ROWCNTR
ON TABLE HOLD FORMAT ALPHA
END
-RUN
?HOLD HOLD


Now that this is done, every row in your hold file has two copies of the data. Now we have to flip it.

APP FI ALTMAS DISK altmas.mas
-RUN
-WRITE ALTMAS FILENAME=HOLD,SUFFIX=FIX
-WRITE ALTMAS SEGNAME=ROWS,SEGTYPE=S0
-WRITE ALTMAS FIELDNAME=ROWCNTR,ALIAS=PLNTNM,FORMAT=I4,ACTUAL=I4,$
-WRITE ALTMAS SEGNAME=SERIAL,SEGTYPE=S0,PARENT=ROWS,OCCURS=2,$
-WRITE ALTMAS FIELDNAME=CNTR,ALIAS=CNTR,FORMAT=I1,ACTUAL=A1,$
-WRITE ALTMAS FIELDNAME=SERIAL,ALIAS=SRL,FORMAT=I8,ACTUAL=A8,$
-WRITE ALTMAS FIELDNAME=LASTNAME,ALIAS=LNM,FORMAT=A25,ACTUAL=A25,$
-WRITE ALTMAS FIELDNAME=FIRSTNAME,ALIAS=FNM,FORMAT=A20,ACTUAL=A20,$
-WRITE ALTMAS FIELDNAME=TELEPHONE,ALIAS=TEL,FORMAT=A10,ACTUAL=A10,$
APP FI ALTMAS DISK hold.ftm
TABLE FILE ALTMAS
PRINT LASTNAME FIRSTNAME TELEPHONE
BY SERIAL
BY CNTR PAGE-BREAK
whatever
END


What the OCCURS segment does is virtually restructure the data so that you are looking at it vertically as opposed to horizontally. You might have to play around with the order of the BY phrases and the page break but this technique is simple and has lots of applications. I used it myself just this week and I learned it over 20 years ago.

I'll be on vacation for a week in a few minutes but hopefully if there is something in this post that you don't understand or cannot translate to your problem, maybe one of the experts or virtuosos can help you out.

Good luck!


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
November 21, 2008, 03:35 PM
TimpyJane
The code below is generating the serial four times across but I'm having trouble getting it to flip in step 2 of this process. Can anyone see what is amiss? I really appreciate your help. Timpy

==========================

TABLE FILE CAR
PRINT
SERIAL
WHERE ( BATCH EQ &YEAR);
WHERE YEAR IN (&BATCH);
WHERE ( CANCEL EQ 0);
WHERE ( AREALOC EQ 0);
ON TABLE SET PAGE-NUM OFF
ON TABLE NOTOTAL
ON TABLE HOLD AS DUMPIT
END
-RUN
-*-EXIT
DEFINE FILE DUMPIT
CNTR1/I1=1;
CNTR2/I1=2;
CNTR3/I1=3;
CNTR4/I1=4;
ROWCNTR/I4=ROWCNTR+1;
END
TABLE FILE DUMPIT
PRINT
CNTR1 SERIAL
CNTR2 SERIAL
CNTR3 SERIAL
CNTR4 SERIAL
BY ROWCNTR
ON TABLE PCHOLD FORMAT PDF
END
-RUN
?HOLD HOLD HOLD HOLD
-*
APP FI DUMPIT DISK DUMPIT.mas
-RUN
-WRITE DUMPIT FILENAME=HOLD,SUFFIX=FIX
-WRITE DUMPIT SEGNAME=ROWS,SEGTYPE=S0
-WRITE DUMPIT FIELDNAME=ROWCNTR,ALIAS=PLNTNM,FORMAT=I4,ACTUAL=I4,$
-WRITE DUMPIT SEGNAME=SERIAL,SEGTYPE=S0,PARENT=ROWS,OCCURS=4,$
-WRITE DUMPIT FIELDNAME=CNTR1,ALIAS=CNTR,FORMAT=I1,ACTUAL=A1,$
-WRITE DUMPIT FIELDNAME=CNTR2,ALIAS=CNTR,FORMAT=I1,ACTUAL=A1,$
-WRITE DUMPIT FIELDNAME=CNTR3,ALIAS=CNTR,FORMAT=I1,ACTUAL=A1,$
-WRITE DUMPIT FIELDNAME=CNTR4,ALIAS=CNTR,FORMAT=I1,ACTUAL=A1,$
-WRITE DUMPIT FIELDNAME=SERIAL,ALIAS=LNM,FORMAT=A17,ACTUAL=A17,$
APP FI DUMPIT DISK hold.ftm
TABLE FILE DUMPIT
PRINT SERIAL
BY SERIAL
BY CNTR PAGE-BREAK
ON TABLE SET PAGE-NUM OFF
ON TABLE NOTOTAL
ON TABLE SET EMPTYREPORT ON
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='COURIER',SIZE=9,COLOR='BLACK',BACKCOLOR='NONE',STYLE=NORMAL,$
LEFTMARGIN = 0,$
TOPMARGIN = 0.125,$
TYPE=TITLE,STYLE=BOLD,$
TYPE=TABFOOTING,STYLE=BOLD,$
TYPE=SUBHEAD,BY=2,STYLE=BOLD,$
TYPE=SUBHEAD,BY=2,LINE=04,OBJECT=FIELD,ITEM=2,SIZE=09,STYLE=BOLD,COLOR='BLACK',$
TYPE=SUBHEAD,BY=2,LINE=05,OBJECT=FIELD,ITEM=2,SIZE=09,STYLE=BOLD,COLOR='BLACK',$
TYPE=REPORT,PAGESIZE=LETTER,$
ENDSTYLE
END


Web Focus Developer Studio Release 7.6.1 Output formats include Excel, PDF, HTML, XML.
November 24, 2008, 12:14 PM
Martin_fmi
Here is a mere demonstration (with the CAR file
) of the technique I am using. First a file with n number of blank lines is created (where n is the number of times you would like to duplicate every row - in your case 2 ). Then you join your table to multiple blank in the created file ( the format of the BLANK_MAS must be FOCUS or you will get an error for duplicate rows ).
 
DEFINE FILE CAR
IND/I10 WITH MODEL = IND + 1;
BLANK/A1 WITH MODEL = '';
END
-RUN

TABLE FILE CAR
PRINT MODEL
IND
BLANK
ON TABLE HOLD AS TMP_FILE FORMAT FOCUS
END
-RUN

EX -LINES 4 EDAPUT MASTER,blank_mas,CV,FILE
FILENAME=BLANK_MAS, SUFFIX=FIX,$
SEGNAME=BLANK_MAS, $
  FIELD=FIELD1 ,ALIAS=  ,A1 ,A1 ,$

FILEDEF BLANK_MAS DISK blank_mas.mas (RECFM F LRECL 1

DEFINE FILE BLANK_MAS
CNT/I3 WITH FIELD1 = CNT + 1;
BLANK/A1 WITH FIELD1 = '';
END
-RUN

-* 8 - ORDER OF DUPLICATION
TABLE FILE BLANK_MAS
PRINT
FIELD1 NOPRINT
BLANK
WHERE CNT LE 8
BY BLANK NOPRINT
ON TABLE HOLD AS TMP_MAS1 FORMAT FOCUS INDEX BLANK
END
-RUN

JOIN BLANK IN TMP_FILE TAG T1 TO MULTIPLE BLANK IN TMP_MAS1 TAG T2 AS JJJ

TABLE FILE TMP_FILE
PRINT
*
END
-EXIT
 



WF 7.6.5 / OS: XP / FOCUS
December 02, 2008, 10:32 AM
TimpyJane
GinnyJakes:

Step 1 - here is my code:
DEFINE FILE MNTITAPP
MSO/A3 = 'MSO';
MAKE/A10 = 'CHEVY';
LAST6/A6 = EDIT(SERIAL, '$$$$$$$$$$$999999');
CNTR1/I1=1;
CNTR2/I1=2;
ROWCNTR/I4=ROWCNTR+1;
END
-*
TABLE FILE MNTITAPP
PRINT CNTR1 MSO MAKE LAST6
CNTR2 MSO MAKE LAST6
BY ROWCNTR PAGE-BREAK
ON TABLE HOLD
END
-RUN

When testing this step by taking the "ON TABLE HOLD" off, the results are:
PAGE1
ROWCNTR CNTR1 MSO MAKE LAST6 CNTR2 MSO MAKE LAST6
1 1 MSO FORD A07343 2 MSO FORD A07343

Does this look correct so far? I appreciate your help with this new learning experience I am having.
Thanks


Web Focus Developer Studio Release 7.6.1 Output formats include Excel, PDF, HTML, XML.
December 02, 2008, 02:39 PM
GinnyJakes
Yes, that looks fine except make your hold file FORMAT ALPHA. Keep on going.

Also, Martin gave you an example of using MacGuyver if you wanted to do that instead.


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google