[SOLVED] Same Report different prompts saved as one combined file
Would like to find out a technique to output a report into one file hopefully without having to create more than one fex since the report is the same other than the parameters. Ultimately, this report will be scheduled (reportcaster?) to run based on providing several criteria of a YearCode and Region (All or only Mainland). Would this use a loop, a new fex with an include of the original report twice or some other method?
In the below example output would show the all regions then only Mainland
All Regions
COUNTRY CAR CARSOLD
ENGLAND JAGUAR 0
JENSEN 0
TRIUMPH 0
*TOTAL ENGLAND 0
JAPAN DATSUN 16
TOYOTA 12
*TOTAL JAPAN 28
FRANCE PEUGEOT 0
*TOTAL FRANCE 0
ITALY ALFA ROMEO 1
MASERATI 0
*TOTAL ITALY 1
W GERMANY AUDI 1
BMW 1
*TOTAL W GERMANY 2
TOTAL 31
MAINLAND REGIONS
COUNTRY CAR CARSOLD
FRANCE PEUGEOT 0
*TOTAL FRANCE 0
ITALY ALFA ROMEO 1
MASERATI 0
*TOTAL ITALY 1
W GERMANY AUDI 1
BMW 1
*TOTAL W GERMANY 2
TOTAL 3
DEFINE FILE CAR
REGION/A20=IF COUNTRY EQ 'ENGLAND' OR COUNTRY EQ 'JAPAN' THEN 'ISLAND' ELSE 'MAINLAND';
END
TABLE FILE CAR
SUM
COMPUTE CARSOLD/I3 = SALES / DEALER_COST;
BY LOWEST REGION NOPRINT
BY LOWEST COUNTRY
BY LOWEST CAR
ON COUNTRY SUBTOTAL AS '*TOTAL'
HEADING
-* How to have Report Header Display "All Regions" if no region is selected ?
-* How to have Report Header Display "Mainland Regions" if NE 'ISLAND' ?
WHERE REGION NE 'ISLAND'; -*How to modify this line so that can run report for ALL or for MAINLAND only?
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE COLUMN-TOTAL AS 'TOTAL'
ON TABLE PCHOLD FORMAT HTML
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
INCLUDE = endeflt,
$
ENDSTYLE
END
This message has been edited. Last edited by: sxschech,
WebFocus 7.7.03 Win7, all output
June 27, 2012, 03:24 PM
Don Garland
DEFINE FILE CAR
REGION/A20=IF COUNTRY EQ 'ENGLAND' OR COUNTRY EQ 'JAPAN' THEN 'ISLAND' ELSE 'MAINLAND';
END
TABLE FILE CAR
SUM
COMPUTE CARSOLD/I3 = SALES / DEALER_COST;
BY 'CAR.ORIGIN.REGION' NOPRINT
BY 'CAR.ORIGIN.COUNTRY'
BY 'CAR.COMP.CAR'
ON CAR.ORIGIN.COUNTRY SUBTOTAL AS '*TOTAL'
WHERE REGION NE & REGION.(OR(<ALL,FOC_NONE>,<MAINLAND,MAINLAND>,<ISLAND,ISLAND>)).REGION.;
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE COLUMN-TOTAL AS 'TOTAL'
ON TABLE PCHOLD FORMAT HTML
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
UNITS=IN,
SQUEEZE=ON,
ORIENTATION=PORTRAIT,
$
TYPE=REPORT,
GRID=OFF,
FONT='TIMES NEW ROMAN',
SIZE=10,
$
ENDSTYLE
END
That helps with the prompt aspect. Any ideas about the merging of the two runs into one report file output.
WebFocus 7.7.03 Win7, all output
June 28, 2012, 09:09 AM
PBrightwell
-SET &OC='OPEN';
-SET &OPR='NE';
-REPEAT CARLOOP 2 TIMES
DEFINE FILE CAR
REGION/A20=IF COUNTRY EQ 'ENGLAND' OR COUNTRY EQ 'JAPAN' THEN 'ISLAND' ELSE 'MAINLAND';
END
TABLE FILE CAR
SUM
COMPUTE CARSOLD/I3 = SALES / DEALER_COST;
BY 'CAR.ORIGIN.REGION' NOPRINT
BY 'CAR.ORIGIN.COUNTRY'
BY 'CAR.COMP.CAR'
ON CAR.ORIGIN.COUNTRY SUBTOTAL AS '*TOTAL'
WHERE REGION &OPR.EVAL & REGION.(OR(<ALL,FOC_NONE>,<MAINLAND,MAINLAND>,<ISLAND,ISLAND>)).REGION.;
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE COLUMN-TOTAL AS 'TOTAL'
ON TABLE PCHOLD FORMAT HTML &OC
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
UNITS=IN,
SQUEEZE=ON,
ORIENTATION=PORTRAIT,
$
TYPE=REPORT,
GRID=OFF,
FONT='TIMES NEW ROMAN',
SIZE=10,
$
ENDSTYLE
END
-RUN
-SET &OC='CLOSE';
-SET &OPR='EQ';
-CARLOOP
-ENDREPEAT
Pat WF 7.6.8, AIX, AS400, NT AS400 FOCUS, AIX FOCUS, Oracle, DB2, JDE, Lotus Notes
June 28, 2012, 02:41 PM
sxschech
Thank you Pat for your help on this. Your suggestion worked and the loop produces the output.
For my understanding of the code... Regarding &OC, does this mean that 'OPEN' is a keyword meaning to keep the html file open and append additional data into it and then 'CLOSE' closes/saves the file so nothing more is added to it?
Lastly, (if you happen to know) when the output is html, the data flows from the first group to the next, when I changed the format to PDF, the second group ended up on it's own page even though space was available to accommodate the rows on page one. In some cases this will be preferred, but in others it would be nice to have all on one page. Is this a pdf thing or is there a page setting to keep together.
WebFocus 7.7.03 Win7, all output
June 28, 2012, 03:44 PM
Doug
quote:
Regarding &OC
I hope you don't take this as being too picky. But, there's really no need for "&OD" with HTML, or is there? Was that just for illustrative purposes or for use if the output was to change to PDF?
June 28, 2012, 04:11 PM
sxschech
Hi Doug,
I tried removing the &OC and looks like for HTML it doesn't need it, but for PDF it does.
WebFocus 7.7.03 Win7, all output
June 28, 2012, 05:07 PM
N.Selph
On PDF you have to do OPEN NOBREAK if you don't want the second report on a new page.