Focal Point
How to combine results of two reports

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

September 28, 2007, 02:10 PM
MrBlurry
How to combine results of two reports
I have a report that presents data for one year. I can of course change this report to process for other years. Here's my question. I'm thinking of running this report for one particular year, then copying that code to the bottom of the FOCEXEC and running that part for another year; after that, I would like to create one report that reflects what the two previous reports showed.

How might I go about doing this?
September 28, 2007, 02:41 PM
Prarie
Do a search on Compound Reports.


In Focus since 1993. WebFOCUS 7.7.03 Win 2003
You can also try to run the report for both years and do a page break for each year.
Just a suggestion.

Good luck

et


FOCUS 7.6 MVS PDF,HTML,EXCEL
are you in PDF or HTML or EXCEL
and please update your signature so we know what version/platform you're on.

are you familiar with the concept of LOOPs?
you'll set your year as an &variable
and execute your single set of code 2 times,
here is a simple example
-SET &YEAR = 2006 ;
-toploop
TABLE FILE ...
IF YEAR IS &YEAR
ON TABLE HOLD AS MYTAB&KOUNTER FORMAT HTMTABLE
END
-RUN
-IF &YEAR IS 2007 GOTO done;
-SET &YEAR = 2007 ;
-GOTO toploop;
-done

-HTMLFORM BEGIN
!IBI.FIL.MYTAB0;
!IBI.FIL.MYTAB1;
-HTMLFORM END

For PDF or EXCEL , you'll need to do what Prarie says, go read up on Compound Reports.
or..do what ET says, alot simpler!




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
I'm not sure what you are wanting to accomplish. If you want your report to be:
Sales for 2007
England $$$$
Italy $$$$
Sales for 2006
England $$$$
Italy $$$$

then using a compound report or a loop will work. Simply add ON TABLE SET COMPOUND OPEN to the first report and ON TABLE SET COMPOUND CLOSE to the last.

However, if what you are wanting is:
Sales for 2007 Sales for 2006
Endland $$$$ $$$$
Italy $$$$ $$$$

then if the data for both years is in the same file, extract both years and use ACROSS sales year. If the data is in different files, extract each year's data and use MATCH to put the files together.


Pat
WF 7.6.8, AIX, AS400, NT
AS400 FOCUS, AIX FOCUS,
Oracle, DB2, JDE, Lotus Notes
Of course it is also quite possible that you need to create one report out of two different files. If that is the case, you may be able to do something like this:

APP FI TEST DISK GamP/TEST.FTM 

TABLE FILE CAR
PRINT CAR BODY MODEL SEATS SALES
BY COUNTRY
IF COUNTRY EQ 'ENGLAND'
ON TABLE HOLD FORMAT ALPHA AS TEST
END
APP FI TEST DISK GamP/TEST.FTM (APPEND

TABLE FILE CAR
PRINT CAR BODY MODEL SEATS SALES
BY COUNTRY
IF COUNTRY EQ 'ITALY'
ON TABLE HOLD FORMAT ALPHA AS TEST
END

TABLE FILE TEST PRINT *
END

As long as the output of the two different reports is exactly the same in terms of lengths of the columns, this will work, also allowing for a change of sort fields and such.

Hope this helps.
GamP


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988