Focal Point
[SOLVED] Fun with Compound Reports part Deux

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

January 03, 2014, 09:32 AM
Jveselka
[SOLVED] Fun with Compound Reports part Deux
Got another special request from a customer....

I need to be able to print several compound reports in one.

Reason. The data that they want is listed on the DB2 tables horizontally, I need it to print vertically.

I was able to fix that with the OVER command and it looks great, however all the reports are stacked on top of each other, I need them next to each other in an excel sheet.

An example of report is current month totals, previous month totals, gain/loss, Change Last Number, and 12 Month percent. The only data I have is the current month, I have to calculate the reset. I was able to do that is separate reports and now I need them all in one side by side in excel....

Any help would be greatly appreciated.
Thanks

JV

This message has been edited. Last edited by: <Kathryn Henning>,


WebFOCUS 8105m
Windows, All Outputs
January 03, 2014, 09:59 AM
Dave
The OVER part works, but then you're stuck. OVER is just for displaying. You can not continue to work with it.

You'll probably have to find another way to make it.

...I don't really understand what you want. Can you explain a bit futher?

Perhaps a sample output?

Greets,
Dave


_____________________
WF: 8.0.0.9 > going 8.2.0.5
January 03, 2014, 12:43 PM
Doug
Ditto to:
quote:
...I don't really understand what you want. Can you explain a bit futher?
Perhaps a sample output?

January 06, 2014, 09:35 AM
jgelona
Sounds like a McGyver request to me.

If you are unfamiliar with the McGyver technique, you may want to see if you can find the Systems Journal, Vol 11 #6 from Nov/Dec 1998 on IBI web site.

I still use this to teach new programmers about McGyver.


In FOCUS since 1985. Prod WF 8.0.08 (z90/Suse Linux) DB (Oracle 11g), Self Serv, Report Caster, WebServer Intel/Linux.
January 07, 2014, 12:14 PM
Jveselka
Not sure how to upload screen shots here so I will try to explain.

Column 1 PolType
Column 2 CurMonth
Column 3 PreMonth
Column 4 Gain/Loss

Each column is a separate report so it would be 4 compound reports printed as one side by side.


WebFOCUS 8105m
Windows, All Outputs
January 07, 2014, 11:08 PM
jvb
Compound report in excel format can be used if these are the four seperate report to be printed in one excel sheet.The syntax could be as below:
TABLE FILE A
PRINT
COLUMN1
...
...
ON TABLE PCHOLD FORMAT EXL2K OPEN NOBREAK
END
TABLE FILE A
PRINT
COLUMN2
...
...
ON TABLE PCHOLD FORMAT EXL2K NOBREAK
END
TABLE FILE A
PRINT
COLUMN3
...
...
ON TABLE PCHOLD FORMAT EXL2K NOBREAK
END
TABLE FILE A
PRINT
COLUMN3
...
...
ON TABLE PCHOLD FORMAT EXL2K CLOSE
END


WF 8.1.04,Infoassist,Oracle, Excel, PDF,HTML.
January 08, 2014, 02:09 AM
Rifaz
Hi Jveselka,

http://forums.informationbuild...1057331/m/8961058672

To display a image, i.e. screenshot, on the forum,
1) Upload the image file to an external FTP site (e.g. www.tinypic.com, no registration needed),
2) Post the URL to the image by either: (1) clicking on the Image URL icon and insert the URL to the image, then choose alignments (left, right, etc.); or (2) wrap the URL with tags [ IMG ]URL-goes-here[ /IMG ] .
If the image file is saved on users’ local or network drive, others will not have access to that file.

Your report looks something like this?

 SET PAGE = NOLEAD

DEFINE FILE CAR
DUMMY/A1='';
END

TABLE FILE CAR
SUM RCOST BY COUNTRY
ON TABLE HOLD AS REPORT1 FORMAT HTML
END

TABLE FILE CAR
SUM DCOST 
BY DUMMY AS ''
BY MODEL
ON TABLE HOLD AS REPORT2 FORMAT HTML
END

TABLE FILE CAR
SUM DCOST 
BY CAR
HEADING
""
""
ON TABLE HOLD AS REPORT3 FORMAT HTML
END

TABLE FILE CAR
SUM RCOST 
BY DUMMY AS ''
BY MODEL
HEADING
""
""
ON TABLE HOLD AS REPORT4 FORMAT HTML
END

-RUN
SET HTMLFORMTYPE=XLS
-HTMLFORM BEGIN
<HTML>
<BODY>
<TABLE WIDTH=600>
<TR><TD>
!IBI.FIL.REPORT1;
</TD>
<TD>
!IBI.FIL.REPORT2;
</TD></TR>
<TR><TD>
!IBI.FIL.REPORT3;
</TD>
<TD>
!IBI.FIL.REPORT4;
</TD></TR>
</TABLE>
</BODY>
</HTML>
-HTLMFORM END
 

You need to do lot of styling to fill the empty cells, if you take this.

Thanks,
Rifaz


-Rifaz

WebFOCUS 7.7.x and 8.x
January 08, 2014, 06:58 AM
Twanette
If they are four reports, but you only have four columns side-by-side, why not combine the data into a single HOLD file and then run the report off the single HOLD file?
(I guess a picture would help).
Do what you need to do to create a HOLD file for the data of each column e.g.
HOLD1 has COLUMN1, HOLD2 has COLUMN2, HOLD3 has COLUMN3 and HOLD4 has COLUMN4.
Now we will use MATCH FILE to combine them:
DEFINE FILE HOLD1
SEQ_NO/I9 = SEQ_NO + 1 ;
END
DEFINE FILE HOLD2
SEQ_NO/I9 = SEQ_NO + 1 ;
END
DEFINE FILE HOLD3
SEQ_NO/I9 = SEQ_NO + 1 ;
END
DEFINE FILE HOLD4
SEQ_NO/I9 = SEQ_NO + 1 ;
END
MATCH FILE HOLD1
SUM COLUMN1
BY SEQ_NO
RUN
FILE HOLD2
SUM COLUMN2
BY SEQ_NO
RUN
FILE HOLD3
SUM COLUMN3
BY SEQ_NO
RUN
FILE HOLD4
SUM COLUMN4
BY SEQ_NO
AFTER MATCH HOLD AS HOLD9999 OLD-OR-NEW
END
-RUN
TABLE FILE HOLD9999
PRINT 
   COLUMN1
   COLUMN2
   COLUMN3
   COLUMN4
END



WebFOCUS 8.2.06 mostly Windows Server
January 08, 2014, 12:49 PM
Jveselka
[IMG:left] [/IMG]

Ok, I hope this works.


WebFOCUS 8105m
Windows, All Outputs
January 08, 2014, 12:59 PM
Jveselka
Ok it did, now I will explain...

As you can see this is how I need the report to look.

4 different reports each report using same DB2 table with different logic. The only try data I have is the data on Report 1.

I run report 2 the same way but pull last month’s date and so on, I am sure you guys see what I am doing.

Below is the code I am using to get the first two reports. I failed to mention the SQL before but I wasn’t sure it was an issue.

I can run this report as is and I get the data I need but it is all vertical.

ENGINE DB2 SET DEFAULT_CONNECTION &SYSQLDBD
SQL DB2 PREPARE SQLOUT FOR

SELECT COALESCE(SUM(A.CAS_VEH_CNT ),0) AS "CAS_VEH"
, COALESCE(SUM(A.MUT_VEH_CNT ),0) AS "MUT_VEH"
, COALESCE(SUM(A.UW_CMS_VEH_CNT),0) AS "CMS_VEH"
, COALESCE(SUM(A.CMB_VEH_CNT ),0) AS "CMB_VEH"
, COALESCE(SUM(A.CAS_UW_POL_CNT),0) AS "CAS_POL"
, COALESCE(SUM(A.MUT_POL_CNT ),0) AS "MUT_POL"
, COALESCE(SUM(A.UW_CMS_POL_CNT),0) AS "CMS_POL"
, COALESCE(SUM(A.CMB_POL_CNT ),0) AS "CMB_POL"
, A.AGT_CTY_CD AS "AGT_CTY"
, A.ACTG_DT
, A.CO_LN_TXT
, A.POL_TYPE_TXT
FROM TXMDSD.IN_PIF_AGT_RPT A
WHERE A.ACTG_DT = '2013-12-31'
AND A.CO_LN_TXT = '1A'
AND (A.POL_TYPE_TXT = '6PAP'
OR A.POL_TYPE_TXT = 'PA6P')

GROUP BY A.AGT_CTY_CD, ACTG_DT, CO_LN_TXT, POL_TYPE_TXT
WITH UR;
END
DEFINE FILE SQLOUT
TOTVEH/P13= CAS_VEH + MUT_VEH + CMS_VEH + CMB_VEH;
TOTMUT/P13= CAS_POL + MUT_POL + CMS_POL + CMB_POL;
END
TABLE FILE SQLOUT
SUM
CAS_VEH OVER
CAS_POL OVER
MUT_VEH OVER
MUT_POL OVER
CMS_VEH OVER
CMS_POL OVER
CMB_VEH OVER
CMB_POL OVER
TOTVEH OVER
TOTMUT
WHERE AGT_CTY EQ '033';
ON TABLE PCHOLD FORMAT EXL2K OPEN NOBREAK
END



ENGINE DB2 SET DEFAULT_CONNECTION &SYSQLDBD
SQL DB2 PREPARE SQLOUT FOR

SELECT COALESCE(SUM(A.CAS_VEH_CNT ),0) AS "CAS_VEH"
, COALESCE(SUM(A.MUT_VEH_CNT ),0) AS "MUT_VEH"
, COALESCE(SUM(A.UW_CMS_VEH_CNT),0) AS "CMS_VEH"
, COALESCE(SUM(A.CMB_VEH_CNT ),0) AS "CMB_VEH"
, COALESCE(SUM(A.CAS_UW_POL_CNT),0) AS "CAS_POL"
, COALESCE(SUM(A.MUT_POL_CNT ),0) AS "MUT_POL"
, COALESCE(SUM(A.UW_CMS_POL_CNT),0) AS "CMS_POL"
, COALESCE(SUM(A.CMB_POL_CNT ),0) AS "CMB_POL"
, AGT_CTY_CD AS "AGT_CTY"
, CO_LN_TXT
FROM TXMDSD.IN_PIF_AGT_RPT A
WHERE A.ACTG_DT = '2013-11-22'
AND A.CO_LN_TXT = '1A'
AND (A.POL_TYPE_TXT = '6PAP'
OR A.POL_TYPE_TXT = 'PA6P')

GROUP BY A.AGT_CTY_CD, CO_LN_TXT
WITH UR;
END
DEFINE FILE SQLOUT
TOTVEH/P13= CAS_VEH + MUT_VEH + CMS_VEH + CMB_VEH;
TOTMUT/P13= CAS_POL + MUT_POL + CMS_POL + CMB_POL;
END
TABLE FILE SQLOUT
SUM
CAS_VEH AS ‘’ OVER
CAS_POL AS ‘’ OVER
MUT_VEH AS ‘’ OVER
MUT_POL AS ‘’ OVER
CMS_VEH AS ‘’ OVER
CMS_POL AS ‘’ OVER
CMB_VEH AS ‘’ OVER
CMB_POL AS ‘’ OVER
TOTVEH AS ‘’ OVER
TOTMUT AS ‘’
WHERE AGT_CTY EQ '033';
ON TABLE PCHOLD FORMAT EXL2K CLOSE
-*ON TABLE HOLD AS CAS_PIF_DATA_2 FORMAT FOCUS INDEX CO_LN_TXT
END


WebFOCUS 8105m
Windows, All Outputs
January 08, 2014, 01:11 PM
Jveselka
[IMG:left] [/IMG]

Here is the report I am trying to produce.


WebFOCUS 8105m
Windows, All Outputs
January 15, 2014, 12:23 PM
Jveselka
Thanks for all the suggestions, we are currently working thru this with a modify and it seems to be working so far.

I also got some information for the MacGyver technique from Twanette, so I will check that out as well.

Thanks again


WebFOCUS 8105m
Windows, All Outputs
January 16, 2014, 05:35 AM
Tony A
I would have thought that pulling the data together within your SQL would be the better solution?
SELECT COALESCE(SUM(A.CAS_VEH_CNT ),0) AS "CAS_VEH"
     , COALESCE(SUM(A.MUT_VEH_CNT ),0) AS "MUT_VEH"
     , COALESCE(SUM(A.UW_CMS_VEH_CNT),0) AS "CMS_VEH"
     , COALESCE(SUM(A.CMB_VEH_CNT ),0) AS "CMB_VEH"
     , COALESCE(SUM(A.CAS_UW_POL_CNT),0) AS "CAS_POL"
     , COALESCE(SUM(A.MUT_POL_CNT ),0) AS "MUT_POL"
     , COALESCE(SUM(A.UW_CMS_POL_CNT),0) AS "CMS_POL"
     , COALESCE(SUM(A.CMB_POL_CNT ),0) AS "CMB_POL"
     , A.AGT_CTY_CD AS "AGT_CTY"
     , A.ACTG_DT
     , A.CO_LN_TXT
     , A.POL_TYPE_TXT
     , 'This Month' AS "MONTH_VAL"
  FROM TXMDSD.IN_PIF_AGT_RPT A
 WHERE A.ACTG_DT = '2013-12-31'
   AND A.CO_LN_TXT = '1A'
   AND (A.POL_TYPE_TXT = '6PAP'
     OR A.POL_TYPE_TXT = 'PA6P')
UNION ALL
SELECT COALESCE(SUM(A.CAS_VEH_CNT ),0) AS "CAS_VEH"
     , COALESCE(SUM(A.MUT_VEH_CNT ),0) AS "MUT_VEH"
     , COALESCE(SUM(A.UW_CMS_VEH_CNT),0) AS "CMS_VEH"
     , COALESCE(SUM(A.CMB_VEH_CNT ),0) AS "CMB_VEH"
     , COALESCE(SUM(A.CAS_UW_POL_CNT),0) AS "CAS_POL"
     , COALESCE(SUM(A.MUT_POL_CNT ),0) AS "MUT_POL"
     , COALESCE(SUM(A.UW_CMS_POL_CNT),0) AS "CMS_POL"
     , COALESCE(SUM(A.CMB_POL_CNT ),0) AS "CMB_POL"
     , AGT_CTY_CD AS "AGT_CTY"
     , A.ACTG_DT
     , A.CO_LN_TXT
     , A.POL_TYPE_TXT
     , 'Last Month' AS "MONTH_VAL"
  FROM TXMDSD.IN_PIF_AGT_RPT A
 WHERE A.ACTG_DT = '2013-11-22'
   AND A.CO_LN_TXT = '1A'
   AND (A.POL_TYPE_TXT = '6PAP'
     OR A.POL_TYPE_TXT = 'PA6P')
;

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10