Focal Point
Create new reports based on previous adhoc selection

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

December 17, 2007, 11:48 AM
Luiz De Assis
Create new reports based on previous adhoc selection
I've created an adhoc report that allows users to select from 5 different parameters displayed as list boxes (HTML Layout Painter). The output is in Excel format. The users are now requesting that new reports be created from their previous report based on the selected values for one of the parameters. For instance, the header of the first report shows the following:

Selected Parameters:
Business Unit:GRPBMG
Ilec Ixc:IXC
Business Line:'DATA_IP'
Product Group:'FRAME' OR 'ATM' OR 'IQ' OR 'ETC'
Product Tier:'ALL'

The subsequent reports (tabs on the same workbook) would have Product Group EQ Frame (2nd report), Product Group EQ ATM (3rd report), Product Group EQ IQ (4th report), and so on. All other selections would stay the same.

The number of tabs on the final report will vary based on the user's number of values selected from the Product Group list.

Appreciate any suggestions you guys might have.
Thank very much!
Luiz
December 17, 2007, 11:54 AM
Francis Mariani
You would simply create a COMPOUND EXL2K report. OPEN the COMPOUND report with the summary report and then, using the Dialogue Manager REPEAT command, loop through the Product Group filter values and run a report for each. On the last one in the loop you would CLOSE the COMPOUND report.


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
December 17, 2007, 12:17 PM
Luiz De Assis
Francis,
So, you're saying that it doesn't matter how many values the user picks for the summary report, right? I have used compound reports before, but not with the REPEAT command. Do you happen to have any examples of it? Thanks for the quick reply!
Luiz
December 17, 2007, 01:16 PM
Francis Mariani
Generally, when you call WebFOCUS with a form object that has more than one value selected, the number of selected values gets passed. E.g. If you select four countries in a COUNTRY drop-down box, the four countries get passed along with the number of countries selected - &COUNTRY1, &COUNTRY2, &COUNTRY3, &COUNTRY4 and &COUNTRY0 with a value of 4.

Taking this to the next step, you could have something like this:

-SET &ECHO=ALL;

-? &

-DEFAULT &Country0 = 1;
-DEFAULT &Country1 = '&Country.EVAL';

-*-- Print main report ---
SET COMPOUND=OPEN
-RUN

-BYPASS_COMP1

TABLE FILE CAR
SUM
SALES
BY COUNTRY
BY CAR
ACROSS MODEL
WHERE COUNTRY EQ '&Country1'

-REPEAT REP1_END FOR &COUNTER FROM 2 TO &Country0;
OR '&Country.&COUNTER'
-REP1_END

ON TABLE SET STYLE *
TITLETEXT=All Selected, $
ENDSTYLE
ON TABLE PCHOLD FORMAT EXL2K
END
-RUN

-*-- Print individual reports ---

-REPEAT REP2_END FOR &COUNTER FROM 1 TO &Country0;

-IF &COUNTER NE &Country0 GOTO BYPASS_COMP2;

SET COMPOUND = CLOSE
-RUN

-BYPASS_COMP2

TABLE FILE CAR
SUM
SALES
BY COUNTRY
BY MODEL
WHERE COUNTRY EQ '&Country.&COUNTER'

ON TABLE SET STYLE *
TITLETEXT=&Country.&COUNTER, $
ENDSTYLE
ON TABLE PCHOLD FORMAT EXL2K
END
-RUN
-REP2_END

The two DEFAULT statements at the top of the code are in case only one Country is selected.

Oh no! I've written your program for you! Let me know if you have questions...


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
December 17, 2007, 01:30 PM
Luiz De Assis
You sure did! Smiler

Thank you so much, and have a great day!
Luiz