As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.
Join the TIBCO Community TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.
From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
Request access to the private WebFOCUS User Group (login required) to network with fellow members.
Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.
I have a report which has to burst by company and then loop through the list of company's contracts and display detail sections for each contract. The list of contracts a company can have varies. Is it possible to save the burst value as an amper variable so that I can use it in WHERE to find the no of contracts to loop through. I have created a compound PDF report with burst and looping logic and it works fine when all the companies have the same no. contracts (in other words, constant no. for looping). I checked related previous posts and couldn't find what I need. Thanks.This message has been edited. Last edited by: CT,
If I understnad this correctly, you could do a "pre-process" which counts the number of contracts (sum cnt.contracts) by company, hold that in a file, then spin thru that file via DM -READ and capture the company and number_of_contracts into variables and use thoses vaule to loop through as required.
Posts: 3132 | Location: Tennessee, Nashville area | Registered: February 23, 2005
Thanks Doug. So, if I a create a hold file with company and no. of contracts and use DM -READ in my template, does it read the next value from the hold file everytime it bursts? What I am wondering is whether the hold file would be open thru the bursting session to read the next value instead of getting the first value every time it burst.
Thank you. I will give it a try. On a second thought, is there a system or some kind of variable that holds the burst counter? Then I can DEFINE a COMPANYCTR in my data extract hold file and use something similar to the code below.
TABLE FILE TESTCTR
PRINT DST.CONTRACTNAME
WHERE COMPANYCTR EQ &burstCtr;
ON TABLE SAVE AS HCNTRCNT
END
-SET &CONTRACTCNT = &LINES;
I think you would have to calculate that yourself. For example, you could use the loop counter you use for your -REPEAT loop.
It sounds like you might want to visit the Dialogue Manager chapter of the Developing Reporting Applications manual and check out all the neat things you can do with -REPEAT and -READ.
You can just play around with the DM part with ECHO on and some -TYPEs to see what goes on. That might give you a better idea of what you have to do.
I tried creating that using -REPEAT. The problem is, when the report bursts, it resets the counter. With each burst value, I get the count for the first company. The bad part is, the ECHO shows debug messages for the last report and I don't know whether there is any way to see the ECHO for all the previous burst values.
I can't imagine what you are doing. You have to save your company and burst values in a separate file that you can -READ NOCLOSE in your -REPEAT loop.
Maybe if you posted the architecture code of your program, i.e. the DM, without the specific report detail or stylesheet of your report (but include the BYs), it would be easier to understand what you are doing.
I'm thinking there's got to be a much easier way to get what you need, but like Ginny, and having a time trying to understand what exactly it is you need.
If all you need is a summary(contract) line and then detail, try an extra join, put your summary information into a subhead line and then PRINT the columns you need in the detail.
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
Posts: 2298 | Location: Salt Lake City, Utah | Registered: February 02, 2007
TABLE FILE CAR
SUM
DEALER_COST
RETAIL_COST
BY COUNTRY
BY CAR
ON TABLE HOLD AS HCAR1
END
DEFINE FILE HCAR1
COUNTRYCNT/I5=
IF COUNTRY EQ LAST COUNTRY
THEN COUNTRYCNT
ELSE COUNTRYCNT + 1;
END
TABLE FILE HCAR1
PRINT
COUNTRY
CAR
DEALER_COST
RETAIL_COST
BY COUNTRYCNT
END
1. I want to burst by country 2. Each report will have a summary page with the list of cars, and then it has to show the graph and detail sections for car 1, graph and detail sections for car 2 etc. I am creating PAGELAYOUT and COMPONENT on the fly based on no. of cars each country has. I have to do it this way because we need the graph and detail sections for a specific car in one page. The problem I have is finding the no. cars each country has. I have setup the &countryCtr and it gets the no. of cars for the first country. When it bursts, it resets the &countryCtr to 1 again instead of incrementing and getting the second one, it gets the no. of cars for the first country. I have it working fine with bursting and looping when I make no. of cars a constant.
I can try to create a complete example with CAR but it might take me some time. Thank you so much every one for all the suggestions.
Ok, I have created a complete example using CAR file. It has six files; car-xtr.fex, car-sum.fex, car-det-gph.fex, car-det1.fex, car-det2.fex, template.car.fex. I have the code for each of these files below. Please save them with those file names and run template-car.fex. It bursts by country and then loops through the list of cars for each country and displays graph and detail sections on one page for each car. Right now I have -SET &carCtr = 2; in template-car file. If you comment that, it doesn't get the car count for each country. Though I am using counters here to keep track of the burst values, I am open to any other methods which gives me the burst value. We have a bunch of high profile reports which needs this report structure and I hope somebody will have a solution. Thank you so much!!
-* File template_car
-SET &&countryCtr = 0;
-TYPE &&countryCtr
-INCLUDE CAR-XTR
-SET &&countryCtr = &&countryCtr + 1;
-TYPE &&countryCtr
TABLE FILE HCAR2
PRINT DST.CAR
WHERE COUNTRYCNT EQ &&countryCtr;
ON TABLE SAVE AS HCARCNT
END
-SET &carCtr = &LINES;
-TYPE &carCtr
-SET &carCtr = 2;
SET HTMLARCHIVE=ON
COMPOUND LAYOUT PCHOLD FORMAT PDF
UNITS=IN, $
SECTION=section1, LAYOUT=ON, METADATA='0.5^0.5^0.5^0.5', MERGE=ON, ORIENTATION=PORTRAIT, PAGESIZE=Letter, $
-SET &LAYOUTNUM = 1;
PAGELAYOUT=&LAYOUTNUM, NAME='Page layout &LAYOUTNUM', text='Page layout &LAYOUTNUM', TOC-LEVEL=1, BOTTOMMARGIN=0.5, TOPMARGIN=1.0, $
COMPONENT='report1', TEXT='report1', TOC-LEVEL=2, POSITION=(0.5 1.000), DIMENSION=(* *), $
-SET &carLoopCtr = 0;
-REPEAT LAYLOOP &carCtr TIMES
-SET &carLoopCtr = &carLoopCtr + 1;
-SET &LAYOUTNUM = &LAYOUTNUM + 1;
-SET &GPHNUM = &carLoopCtr + 1 ;
-SET &RPTNUM = &carLoopCtr + 2;
-SET &REPORTNUM = &carLoopCtr + 3;
PAGELAYOUT=&LAYOUTNUM, NAME='Page layout &LAYOUTNUM', text='Page layout &LAYOUTNUM', TOC-LEVEL=1, BOTTOMMARGIN=0.5, TOPMARGIN=1.0, $
COMPONENT='graph&GPHNUM', TEXT='graph&GPHNUM', TOC-LEVEL=2, POSITION=(1 1.000), DIMENSION=(* *), $
COMPONENT='report&RPTNUM', TEXT='report&RPTNUM', TOC-LEVEL=2, POSITION=(+0.000 +1.8), DIMENSION=(* *), RELATIVE-TO='graph&GPHNUM', RELATIVE-POINT=BOTTOM-LEFT, POSITION-POINT=TOP-LEFT, $
COMPONENT='rep&REPORTNUM', TEXT='rep&REPORTNUM', TOC-LEVEL=2, POSITION=(+0.000 +0.0), DIMENSION=(* *), RELATIVE-TO='report&RPTNUM', RELATIVE-POINT=BOTTOM-LEFT, POSITION-POINT=TOP-LEFT, $
-LAYLOOP
END
-*Summary graph
SET COMPONENT='report1'
-INCLUDE car-sum
-*Detail graph and detail reports times number of cars per country
-SET &carLoopCtr = 0;
-REPEAT RPTLOOP &carCtr TIMES
-SET &carLoopCtr = &carLoopCtr + 1;
-SET &GPHNUM = &carLoopCtr + 1 ;
-SET &RPTNUM = &carLoopCtr + 2;
-SET &REPORTNUM = &carLoopCtr + 3;
SET COMPONENT='graph&GPHNUM'
-INCLUDE CAR-DET-GPH
SET COMPONENT='report&RPTNUM'
-INCLUDE CAR-DET1
SET COMPONENT='rep&REPORTNUM'
-INCLUDE CAR-DET2
-RPTLOOP
COMPOUND END
-------------------------------------------------
-* File car-xtr.fex
TABLE FILE CAR
SUM
DEALER_COST
RETAIL_COST
SALES
MAX.BODYTYPE
MAX.SEATS
BY COUNTRY
BY CAR
BY MODEL
WHERE COUNTRY NE 'FRANCE';
ON TABLE HOLD AS HCAR1
END
DEFINE FILE HCAR1
COUNTRYCNT/I5=
IF COUNTRY EQ LAST COUNTRY
THEN COUNTRYCNT
ELSE COUNTRYCNT + 1;
CARCNT/I5=
IF COUNTRY EQ LAST COUNTRY
THEN (IF CAR EQ LAST CAR
THEN CARCNT
ELSE CARCNT + 1)
ELSE 1;
END
TABLE FILE HCAR1
PRINT
MAX.COUNTRYCNT
MAX.CARCNT
MODEL
DEALER_COST
RETAIL_COST
SALES
BODYTYPE
SEATS
BY COUNTRY
BY CAR
ON TABLE HOLD AS HCAR2
END
-------------------------------------------------------
-* File car-sum.fex
TABLE FILE HCAR2
SUM
DEALER_COST
RETAIL_COST
SALES
BY COUNTRY
BY CAR
HEADING
"Country Summary Report"
" "
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT PDF
ON TABLE SET PAGE-NUM OFF
ON TABLE SET STYLE *
TYPE=REPORT, FONT='ARIAL', SIZE=8, GRID=OFF, $
ENDSTYLE
END
-----------------------------------------------------------------
-* File car-det-gph.fex
GRAPH FILE HCAR2
SUM DEALER_COST
BY COUNTRY NOPRINT
BY MODEL
WHERE CARCNT EQ &carLoopCtr;
ON GRAPH HOLD AS HOLD FORMAT SVG
ON GRAPH SET GRAPHDEFAULT OFF
ON GRAPH SET GRAPHEDIT SERVER
ON GRAPH SET GRMERGE ADVANCED
ON GRAPH SET GRMULTIGRAPH 1
ON GRAPH SET 3D OFF
ON GRAPH SET VZERO ON
ON GRAPH SET GRLEGEND 0
ON GRAPH SET GRXAXIS 1
ON GRAPH SET HAXIS 6
ON GRAPH SET VAXIS 3
ON GRAPH SET UNITS INCHES
ON GRAPH SET LOOKGRAPH PIESINGL
ON GRAPH SET GRAPHSTYLE *
setTemplateFile("/images/tdg/template/IBITrueColors.txt");
setReportParsingErrors(false);
setSelectionEnableMove(false);
setPieFeelerTextDisplay(1);
setLegendPosition(2);
setDisplay(getPieLabel(),false);
setPlace(false);
setPlaceResize(getPieSliceLabel(),0);
setFontName(getPieSliceLabel(),"Arial");
setFontName(getLegendText(),"Arial");
setFontName(getSubtitle(),"Arial");
setTextString(getTitle(),"");
setTextString(getSubtitle(),"Car Detail Graph");
setDisplay(getSubtitle(),true);
setFontSizeAbsolute(getSubtitle(),true);
setFontSizeInPoints(getSubtitle(),8);
setFontStyle(getSubtitle(),0);
setPlaceResize(getLegendText(),0);
setFontSizeAbsolute(getLegendText(),true);
setFontSizeInPoints(getLegendText(),6);
setFontSizeAbsolute(getPieSliceLabel(),true);
setFontSizeInPoints(getPieSliceLabel(),6);
setFillColor(getChartBackground(),new Color(255,255,255));
setTransparentBorderColor(getChartBackground(),true);
setPieDepth(0);
setPieTilt(0);
setOtherPieLabelDisplay(0);
setPieLabelDisplay(0);
setTextFormatPreset(getPieSliceLabel(),1);
setLegendTextAutosize(true);
ENDSTYLE
END
END
TABLE FILE HCAR2
" "
SUM
COMPUTE CNTR/I4 = CNTR + 1; NOPRINT
COMPUTE CNTR2/A4 = IF &FOCGRAPHCNT EQ 1 THEN ' ' ELSE FTOA(CNTR-1,'(F4)','A4'); NOPRINT
COMPUTE IMG/A18 = 'HOLD'||LJUST(4,CNTR2,'A4')|| '.svg';NOPRINT
BY COUNTRY NOPRINT
ON COUNTRY PAGE-BREAK
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE PCHOLD FORMAT PDF
ON TABLE SET STYLE *
TYPE=HEADING, IMAGE=(IMG), position=(-1 0), $
TYPE=REPORT,PAGE-LOCATION=OFF,$
END
-----------------------------------------------------------------------
-* File car-det1.fex
TABLE FILE HCAR2
SUM
DEALER_COST
RETAIL_COST
BY COUNTRY NOPRINT
BY CAR
BY MODEL
WHERE CARCNT EQ &carLoopCtr;
HEADING
"Car Detail-1 Report"
" "
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT PDF
ON TABLE SET PAGE-NUM OFF
ON TABLE SET STYLE *
TYPE=REPORT, FONT='ARIAL', SIZE=8, GRID=OFF, $
ENDSTYLE
END
-----------------------------------------------------------------
-* File car-det1.fex
TABLE FILE HCAR2
PRINT
BODYTYPE
SEATS
BY COUNTRY NOPRINT
BY CAR
BY MODEL
WHERE CARCNT EQ &carLoopCtr;
HEADING
"Car Detail-2 Report"
" "
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT PDF
ON TABLE SET PAGE-NUM OFF
ON TABLE SET STYLE *
TYPE=REPORT, FONT='ARIAL', SIZE=8, GRID=OFF, $
ENDSTYLE
END
Sorry, it didn't work. It gets &&countryCtr as 1 for the first country (England) and then sets &carCtr as 3 which is correct. But when it burst by the next country (ITALY), it resets &&countryCtr as 1 again instead of retaining previous value and incrementing by 1. So, for all the countries, it gets the no. of cars as the no. of cars for the first country.
I need to know the burst value or some kind of counter to get the no. of cars for each country.
I think this needs to be within the REPEAT loop, otherwise it only gets executed once.
TABLE FILE HCAR2
PRINT DST.CAR
WHERE COUNTRYCNT EQ &&countryCtr;
ON TABLE SAVE AS HCARCNT
END
-RUN
-SET &carCtr = &LINES;
As well, pay attention to this Focalpoint posting, Observations on PDF Layout Painter. After I added -RUN everywhere I thought it should be, I got the following errors running your code:
(FOC3300) BY Value: (ITALY) MISMATCHED IN MERGED REPORT
(FOC3300) BY Value: (JAPAN) MISMATCHED IN MERGED REPORT
(FOC3300) BY Value: (W GERMANY) MISMATCHED IN MERGED REPORT
(FOC3296) Error found in Coordinated Compound Report: At Component report5
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
This is the result of the execution of the code, with SET MSG=ON:
========== countryCtr: 0 ==========
TABLE FILE CAR
SUM
DEALER_COST
RETAIL_COST
SALES
MAX.BODYTYPE
MAX.SEATS
BY COUNTRY
BY CAR
BY MODEL
WHERE COUNTRY NE 'FRANCE';
ON TABLE HOLD AS HCAR1
END
0 NUMBER OF RECORDS IN TABLE= 17 LINES= 17
DEFINE FILE HCAR1
COUNTRYCNT/I5=
IF COUNTRY EQ LAST COUNTRY
THEN COUNTRYCNT
ELSE COUNTRYCNT + 1;
CARCNT/I5=
IF COUNTRY EQ LAST COUNTRY
THEN (IF CAR EQ LAST CAR
THEN CARCNT
ELSE CARCNT + 1)
ELSE 1;
END
TABLE FILE HCAR1
PRINT
MAX.COUNTRYCNT
MAX.CARCNT
MODEL
DEALER_COST
RETAIL_COST
SALES
BODYTYPE
SEATS
BY COUNTRY
BY CAR
ON TABLE HOLD AS HCAR2
END
0 NUMBER OF RECORDS IN TABLE= 17 LINES= 17
========== countryCtr: 1 ==========
TABLE FILE HCAR2
PRINT DST.CAR
WHERE COUNTRYCNT EQ 1;
ON TABLE SAVE AS HCARCNT
END
0 NUMBER OF RECORDS IN TABLE= 4 LINES= 3
ALPHANUMERIC RECORD NAMED HCARCNT
0 FIELDNAME ALIAS FORMAT LENGTH
CAR E02 A16 16
CAR E02 A16 16
TOTAL 32
========== carCtr: 3 ==========
SET HTMLARCHIVE=ON
COMPOUND LAYOUT PCHOLD FORMAT PDF
UNITS=IN, $
SECTION=section1, LAYOUT=ON, METADATA='0.5^0.5^0.5^0.5', MERGE=ON, ORIENTATION=PORTRAIT, PAGESIZE=Letter, $
PAGELAYOUT=1, NAME='Page layout 1', text='Page layout 1', TOC-LEVEL=1, BOTTOMMARGIN=0.5, TOPMARGIN=1.0, $
COMPONENT='report1', TEXT='report1', TOC-LEVEL=2, POSITION=(0.5 1.000), DIMENSION=(* *), $
++++++++++ LAYLOOP Start - carLoopCtr: 1 ++++++++++
PAGELAYOUT=2, NAME='Page layout 2', text='Page layout 2', TOC-LEVEL=1, BOTTOMMARGIN=0.5, TOPMARGIN=1.0, $
COMPONENT='graph2', TEXT='graph2', TOC-LEVEL=2, POSITION=(1 1.000), DIMENSION=(* *), $
COMPONENT='report3', TEXT='report3', TOC-LEVEL=2, POSITION=(+0.000 +1.8), DIMENSION=(* *), RELATIVE-TO='graph2', RELATIVE-POINT=BOTTOM-LEFT, POSITION-POINT=TOP-LEFT, $
COMPONENT='rep4', TEXT='rep4', TOC-LEVEL=2, POSITION=(+0.000 +0.0), DIMENSION=(* *), RELATIVE-TO='report3', RELATIVE-POINT=BOTTOM-LEFT, POSITION-POINT=TOP-LEFT, $
++++++++++ LAYLOOP End - carLoopCtr: 1 ++++++++++
++++++++++ LAYLOOP Start - carLoopCtr: 2 ++++++++++
PAGELAYOUT=3, NAME='Page layout 3', text='Page layout 3', TOC-LEVEL=1, BOTTOMMARGIN=0.5, TOPMARGIN=1.0, $
COMPONENT='graph3', TEXT='graph3', TOC-LEVEL=2, POSITION=(1 1.000), DIMENSION=(* *), $
COMPONENT='report4', TEXT='report4', TOC-LEVEL=2, POSITION=(+0.000 +1.8), DIMENSION=(* *), RELATIVE-TO='graph3', RELATIVE-POINT=BOTTOM-LEFT, POSITION-POINT=TOP-LEFT, $
COMPONENT='rep5', TEXT='rep5', TOC-LEVEL=2, POSITION=(+0.000 +0.0), DIMENSION=(* *), RELATIVE-TO='report4', RELATIVE-POINT=BOTTOM-LEFT, POSITION-POINT=TOP-LEFT, $
++++++++++ LAYLOOP End - carLoopCtr: 2 ++++++++++
++++++++++ LAYLOOP Start - carLoopCtr: 3 ++++++++++
PAGELAYOUT=4, NAME='Page layout 4', text='Page layout 4', TOC-LEVEL=1, BOTTOMMARGIN=0.5, TOPMARGIN=1.0, $
COMPONENT='graph4', TEXT='graph4', TOC-LEVEL=2, POSITION=(1 1.000), DIMENSION=(* *), $
COMPONENT='report5', TEXT='report5', TOC-LEVEL=2, POSITION=(+0.000 +1.8), DIMENSION=(* *), RELATIVE-TO='graph4', RELATIVE-POINT=BOTTOM-LEFT, POSITION-POINT=TOP-LEFT, $
COMPONENT='rep6', TEXT='rep6', TOC-LEVEL=2, POSITION=(+0.000 +0.0), DIMENSION=(* *), RELATIVE-TO='report5', RELATIVE-POINT=BOTTOM-LEFT, POSITION-POINT=TOP-LEFT, $
++++++++++ LAYLOOP End - carLoopCtr: 3 ++++++++++
END
SET COMPONENT='report1'
TABLE FILE HCAR2
SUM
DEALER_COST
RETAIL_COST
SALES
BY COUNTRY
BY CAR
HEADING
"Country Summary Report"
" "
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT PDF
ON TABLE SET PAGE-NUM OFF
ON TABLE SET STYLE *
TYPE=REPORT, FONT='ARIAL', SIZE=8, GRID=OFF, $
ENDSTYLE
END
0 NUMBER OF RECORDS IN TABLE= 17 LINES= 9
++++++++++ RPTLOOP Start - carLoopCtr: 1 ++++++++++
SET COMPONENT='graph2'
GRAPH FILE HCAR2
SUM DEALER_COST
BY COUNTRY NOPRINT
BY MODEL
WHERE CARCNT EQ 1;
ON GRAPH HOLD AS HOLD FORMAT SVG
ON GRAPH SET GRAPHDEFAULT OFF
ON GRAPH SET GRAPHEDIT SERVER
ON GRAPH SET GRMERGE ADVANCED
ON GRAPH SET GRMULTIGRAPH 1
ON GRAPH SET 3D OFF
ON GRAPH SET VZERO ON
ON GRAPH SET GRLEGEND 0
ON GRAPH SET GRXAXIS 1
ON GRAPH SET HAXIS 6
ON GRAPH SET VAXIS 3
ON GRAPH SET UNITS INCHES
ON GRAPH SET LOOKGRAPH PIESINGL
ON GRAPH SET GRAPHSTYLE *
setTemplateFile("/images/tdg/template/IBITrueColors.txt");
setReportParsingErrors(false);
setSelectionEnableMove(false);
setPieFeelerTextDisplay(1);
setLegendPosition(2);
setDisplay(getPieLabel(),false);
setPlace(false);
setPlaceResize(getPieSliceLabel(),0);
setFontName(getPieSliceLabel(),"Arial");
setFontName(getLegendText(),"Arial");
setFontName(getSubtitle(),"Arial");
setTextString(getTitle(),"");
setTextString(getSubtitle(),"Car Detail Graph");
setDisplay(getSubtitle(),true);
setFontSizeAbsolute(getSubtitle(),true);
setFontSizeInPoints(getSubtitle(),8);
setFontStyle(getSubtitle(),0);
setPlaceResize(getLegendText(),0);
setFontSizeAbsolute(getLegendText(),true);
setFontSizeInPoints(getLegendText(),6);
setFontSizeAbsolute(getPieSliceLabel(),true);
setFontSizeInPoints(getPieSliceLabel(),6);
setFillColor(getChartBackground(),new Color(255,255,255));
setTransparentBorderColor(getChartBackground(),true);
setPieDepth(0);
setPieTilt(0);
setOtherPieLabelDisplay(0);
setPieLabelDisplay(0);
setTextFormatPreset(getPieSliceLabel(),1);
setLegendTextAutosize(true);
ENDSTYLE
END
0 NUMBER OF RECORDS IN GRAPH= 7 PLOT POINTS= 7
SVG FILE SAVED ...
END
TABLE FILE HCAR2
" "
SUM
COMPUTE CNTR/I4 = CNTR + 1; NOPRINT
COMPUTE CNTR2/A4 = IF 4 EQ 1 THEN ' ' ELSE FTOA(CNTR-1,'(F4)','A4'); NOPRINT
COMPUTE IMG/A18 = 'HOLD'||LJUST(4,CNTR2,'A4')|| '.svg';NOPRINT
BY COUNTRY NOPRINT
ON COUNTRY PAGE-BREAK
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE PCHOLD FORMAT PDF
ON TABLE SET STYLE *
TYPE=HEADING, IMAGE=(IMG), position=(-1 0), $
TYPE=REPORT,PAGE-LOCATION=OFF,$
END
0 NUMBER OF RECORDS IN TABLE= 17 LINES= 4
SET COMPONENT='report3'
TABLE FILE HCAR2
SUM
DEALER_COST
RETAIL_COST
BY COUNTRY NOPRINT
BY CAR
BY MODEL
WHERE CARCNT EQ 1;
HEADING
"Car Detail-1 Report"
" "
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT PDF
ON TABLE SET PAGE-NUM OFF
ON TABLE SET STYLE *
TYPE=REPORT, FONT='ARIAL', SIZE=8, GRID=OFF, $
ENDSTYLE
END
0 NUMBER OF RECORDS IN TABLE= 7 LINES= 7
SET COMPONENT='rep4'
TABLE FILE HCAR2
PRINT
BODYTYPE
SEATS
BY COUNTRY NOPRINT
BY CAR
BY MODEL
WHERE CARCNT EQ 1;
HEADING
"Car Detail-2 Report"
" "
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT PDF
ON TABLE SET PAGE-NUM OFF
ON TABLE SET STYLE *
TYPE=REPORT, FONT='ARIAL', SIZE=8, GRID=OFF, $
ENDSTYLE
END
0 NUMBER OF RECORDS IN TABLE= 7 LINES= 7
++++++++++ RPTLOOP End - carLoopCtr: 1 ++++++++++
++++++++++ RPTLOOP Start - carLoopCtr: 2 ++++++++++
SET COMPONENT='graph3'
GRAPH FILE HCAR2
SUM DEALER_COST
BY COUNTRY NOPRINT
BY MODEL
WHERE CARCNT EQ 2;
ON GRAPH HOLD AS HOLD FORMAT SVG
ON GRAPH SET GRAPHDEFAULT OFF
ON GRAPH SET GRAPHEDIT SERVER
ON GRAPH SET GRMERGE ADVANCED
ON GRAPH SET GRMULTIGRAPH 1
ON GRAPH SET 3D OFF
ON GRAPH SET VZERO ON
ON GRAPH SET GRLEGEND 0
ON GRAPH SET GRXAXIS 1
ON GRAPH SET HAXIS 6
ON GRAPH SET VAXIS 3
ON GRAPH SET UNITS INCHES
ON GRAPH SET LOOKGRAPH PIESINGL
ON GRAPH SET GRAPHSTYLE *
setTemplateFile("/images/tdg/template/IBITrueColors.txt");
setReportParsingErrors(false);
setSelectionEnableMove(false);
setPieFeelerTextDisplay(1);
setLegendPosition(2);
setDisplay(getPieLabel(),false);
setPlace(false);
setPlaceResize(getPieSliceLabel(),0);
setFontName(getPieSliceLabel(),"Arial");
setFontName(getLegendText(),"Arial");
setFontName(getSubtitle(),"Arial");
setTextString(getTitle(),"");
setTextString(getSubtitle(),"Car Detail Graph");
setDisplay(getSubtitle(),true);
setFontSizeAbsolute(getSubtitle(),true);
setFontSizeInPoints(getSubtitle(),8);
setFontStyle(getSubtitle(),0);
setPlaceResize(getLegendText(),0);
setFontSizeAbsolute(getLegendText(),true);
setFontSizeInPoints(getLegendText(),6);
setFontSizeAbsolute(getPieSliceLabel(),true);
setFontSizeInPoints(getPieSliceLabel(),6);
setFillColor(getChartBackground(),new Color(255,255,255));
setTransparentBorderColor(getChartBackground(),true);
setPieDepth(0);
setPieTilt(0);
setOtherPieLabelDisplay(0);
setPieLabelDisplay(0);
setTextFormatPreset(getPieSliceLabel(),1);
setLegendTextAutosize(true);
ENDSTYLE
END
0 NUMBER OF RECORDS IN GRAPH= 9 PLOT POINTS= 9
SVG FILE SAVED ...
END
TABLE FILE HCAR2
" "
SUM
COMPUTE CNTR/I4 = CNTR + 1; NOPRINT
COMPUTE CNTR2/A4 = IF 4 EQ 1 THEN ' ' ELSE FTOA(CNTR-1,'(F4)','A4'); NOPRINT
COMPUTE IMG/A18 = 'HOLD'||LJUST(4,CNTR2,'A4')|| '.svg';NOPRINT
BY COUNTRY NOPRINT
ON COUNTRY PAGE-BREAK
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE PCHOLD FORMAT PDF
ON TABLE SET STYLE *
TYPE=HEADING, IMAGE=(IMG), position=(-1 0), $
TYPE=REPORT,PAGE-LOCATION=OFF,$
END
0 NUMBER OF RECORDS IN TABLE= 17 LINES= 4
SET COMPONENT='report4'
TABLE FILE HCAR2
SUM
DEALER_COST
RETAIL_COST
BY COUNTRY NOPRINT
BY CAR
BY MODEL
WHERE CARCNT EQ 2;
HEADING
"Car Detail-1 Report"
" "
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT PDF
ON TABLE SET PAGE-NUM OFF
ON TABLE SET STYLE *
TYPE=REPORT, FONT='ARIAL', SIZE=8, GRID=OFF, $
ENDSTYLE
END
0 NUMBER OF RECORDS IN TABLE= 9 LINES= 9
SET COMPONENT='rep5'
TABLE FILE HCAR2
PRINT
BODYTYPE
SEATS
BY COUNTRY NOPRINT
BY CAR
BY MODEL
WHERE CARCNT EQ 2;
HEADING
"Car Detail-2 Report"
" "
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT PDF
ON TABLE SET PAGE-NUM OFF
ON TABLE SET STYLE *
TYPE=REPORT, FONT='ARIAL', SIZE=8, GRID=OFF, $
ENDSTYLE
END
0 NUMBER OF RECORDS IN TABLE= 9 LINES= 9
++++++++++ RPTLOOP End - carLoopCtr: 2 ++++++++++
++++++++++ RPTLOOP Start - carLoopCtr: 3 ++++++++++
SET COMPONENT='graph4'
GRAPH FILE HCAR2
SUM DEALER_COST
BY COUNTRY NOPRINT
BY MODEL
WHERE CARCNT EQ 3;
ON GRAPH HOLD AS HOLD FORMAT SVG
ON GRAPH SET GRAPHDEFAULT OFF
ON GRAPH SET GRAPHEDIT SERVER
ON GRAPH SET GRMERGE ADVANCED
ON GRAPH SET GRMULTIGRAPH 1
ON GRAPH SET 3D OFF
ON GRAPH SET VZERO ON
ON GRAPH SET GRLEGEND 0
ON GRAPH SET GRXAXIS 1
ON GRAPH SET HAXIS 6
ON GRAPH SET VAXIS 3
ON GRAPH SET UNITS INCHES
ON GRAPH SET LOOKGRAPH PIESINGL
ON GRAPH SET GRAPHSTYLE *
setTemplateFile("/images/tdg/template/IBITrueColors.txt");
setReportParsingErrors(false);
setSelectionEnableMove(false);
setPieFeelerTextDisplay(1);
setLegendPosition(2);
setDisplay(getPieLabel(),false);
setPlace(false);
setPlaceResize(getPieSliceLabel(),0);
setFontName(getPieSliceLabel(),"Arial");
setFontName(getLegendText(),"Arial");
setFontName(getSubtitle(),"Arial");
setTextString(getTitle(),"");
setTextString(getSubtitle(),"Car Detail Graph");
setDisplay(getSubtitle(),true);
setFontSizeAbsolute(getSubtitle(),true);
setFontSizeInPoints(getSubtitle(),8);
setFontStyle(getSubtitle(),0);
setPlaceResize(getLegendText(),0);
setFontSizeAbsolute(getLegendText(),true);
setFontSizeInPoints(getLegendText(),6);
setFontSizeAbsolute(getPieSliceLabel(),true);
setFontSizeInPoints(getPieSliceLabel(),6);
setFillColor(getChartBackground(),new Color(255,255,255));
setTransparentBorderColor(getChartBackground(),true);
setPieDepth(0);
setPieTilt(0);
setOtherPieLabelDisplay(0);
setPieLabelDisplay(0);
setTextFormatPreset(getPieSliceLabel(),1);
setLegendTextAutosize(true);
ENDSTYLE
END
0 NUMBER OF RECORDS IN GRAPH= 1 PLOT POINTS= 1
SVG FILE SAVED ...
END
TABLE FILE HCAR2
" "
SUM
COMPUTE CNTR/I4 = CNTR + 1; NOPRINT
COMPUTE CNTR2/A4 = IF 1 EQ 1 THEN ' ' ELSE FTOA(CNTR-1,'(F4)','A4'); NOPRINT
COMPUTE IMG/A18 = 'HOLD'||LJUST(4,CNTR2,'A4')|| '.svg';NOPRINT
BY COUNTRY NOPRINT
ON COUNTRY PAGE-BREAK
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE PCHOLD FORMAT PDF
ON TABLE SET STYLE *
TYPE=HEADING, IMAGE=(IMG), position=(-1 0), $
TYPE=REPORT,PAGE-LOCATION=OFF,$
END
0 NUMBER OF RECORDS IN TABLE= 17 LINES= 4
SET COMPONENT='report5'
TABLE FILE HCAR2
SUM
DEALER_COST
RETAIL_COST
BY COUNTRY NOPRINT
BY CAR
BY MODEL
WHERE CARCNT EQ 3;
HEADING
"Car Detail-1 Report"
" "
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT PDF
ON TABLE SET PAGE-NUM OFF
ON TABLE SET STYLE *
TYPE=REPORT, FONT='ARIAL', SIZE=8, GRID=OFF, $
ENDSTYLE
END
0 NUMBER OF RECORDS IN TABLE= 1 LINES= 1
(FOC3300) BY Value: (ITALY) MISMATCHED IN MERGED REPORT
(FOC3300) BY Value: (JAPAN) MISMATCHED IN MERGED REPORT
(FOC3300) BY Value: (W GERMANY) MISMATCHED IN MERGED REPORT
(FOC3296) Error found in Coordinated Compound Report: At Component report5
Compound Report is TERMINATING.....
You might want to review this result to see if it is doing what you're expecting it to do.This message has been edited. Last edited by: Francis Mariani,
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
Francis, Thanks for for trying it out. The errors are because, the countryCtr value is 1 no matter what the burst value is (Italy, Japan, or W Germany). I wanted the &&countryCtr to increment by 1 every time it bursts which is not happening and that is the real problem. The MISMATCHED IN MERGED REPORT errors are due to the fact that it's expecting 3 cars (which is the count for England) for other countries and they just have 2 cars each. You can see that if you hard code the value of &carCtr in template-car.fex as in my prvious posting. The report runs fine with 2 cars for each country.
-SET &carCtr = 2;
But I want the no. of cars to change based on the country. So, I need the &&countryCtr to increment by 1 every time it bursts. ========== countryCtr: 1 ========== TABLE FILE HCAR2 PRINT DST.CAR WHERE COUNTRYCNT EQ 1; ON TABLE SAVE AS HCARCNT [/CODE]
Francis, I tried adding the -REPEAT loop in template-car.fex. Basically, I did
-REPEAT COUNTRYLOOP 4 TIMES
-SET &&countryCtr = &&countryCtr + 1;
-TYPE &&countryCtr
TABLE FILE HCAR2
PRINT DST.CAR
WHERE COUNTRYCNT EQ &&countryCtr;
ON TABLE SAVE AS HCARCNT
END
-RUN
-SET &carCtr = &LINES;
-*rest of the code in between
COMPOUND END
-COUNTRYLOOP
I see the &&countryCtr getting incremented in ECHO message, but I get MISMATCHED IN MERGED REPORT errors and I don't know why. The same code works if I hard code &carCtr = 2. I just don't know why it fails when it gets the third car for England. I don't know whether it is because of using REPEAT with bursting? Are there any other ways of getting this compound pdf report structure? I truly appreciate any help with this. Thanks.
CT, please take a look at the following code. I have worked out the looping by country and car. Determining the number of cars per country is done outside of the main loops - the compound report syntax didn't like a TABLE FILE inside the loops, instead &carCount1 &carCount2, etc variables are created - one for each Country.
Try running just this code to see the loops in action. Then carefully add the compound layout syntax in the correct areas of the code. This is all I can do for the moment
-* File template_car
-SET &ECHO=ON;
SET HOLDLIST=PRINTONLY
SET HOLDFORMAT=ALPHA
SET ASNAMES=ON
SET PAGE=NOLEAD
-RUN
-*-- Prepare data for compound report ----------------------
-INCLUDE CAR-XTR
-*-- Determine the number of countries to process ----------
TABLE FILE HCAR2
SUM COUNTRY
BY COUNTRY
ON TABLE HOLD
END
-RUN
-SET &countryCount = &LINES;
-TYPE ========== countryCount: &countryCount ==========
-*-- Determine the number of cars per country to process ---
TABLE FILE HCAR2
SUM
MAX.CARCNT
BY COUNTRY NOPRINT
ON TABLE SAVE AS HCARCOUNT
END
-RUN
-SET &CTR = 1;
-REPEAT LOOP0 FOR &CTR FROM 1 TO &countryCount
-READ HCARCOUNT &carCount.&CTR.I5.
-TYPE ===== carCount for country &CTR : &carCount.&CTR =====
-LOOP0
-SET &countryCtr = 1;
-*-- Compound Layout report - Start ----------------------------------------------------------------
-* Beginning of Compound Layout syntax goes here
-*-- LOOP1 - Process each country --------------------------------------------------------
-REPEAT LOOP1 &countryCount TIMES
-TYPE ========== countryCtr: &countryCtr ==========
TABLE FILE HCAR2
SUM SALES
BY COUNTRY NOPRINT
HEADING
"COUNTRY REPORT FOR COUNTRY: <COUNTRY"
BY COUNTRY NOPRINT
WHERE COUNTRYCNT EQ &countryCtr
ON TABLE SET STYLE *
TYPE=REPORT, COLOR=BLUE, STYLE=BOLD, $
ENDSTYLE
END
-RUN
-SET &carCtr = 1;
-*-- LOOP2 - Process each car --------------------------------------------------
-REPEAT LOOP2 &carCount.&carCtr TIMES
TABLE FILE HCAR2
SUM
SALES
DEALER_COST
BY COUNTRY NOPRINT
BY CAR NOPRINT
BY MODEL
HEADING
"REPORT 1 FOR COUNTRY: <COUNTRY / CAR: <CAR"
WHERE COUNTRYCNT EQ &countryCtr
WHERE CARCNT EQ &carCtr
ON TABLE SET STYLE *
TYPE=REPORT, COLOR=RED, $
ENDSTYLE
END
-RUN
TABLE FILE HCAR2
SUM
SALES
RETAIL_COST
BY COUNTRY
BY CAR
BY MODEL
HEADING
"REPORT 2 FOR COUNTRY: <COUNTRY / CAR: <CAR"
WHERE COUNTRYCNT EQ &countryCtr
WHERE CARCNT EQ &carCtr
ON TABLE SET STYLE *
TYPE=REPORT, COLOR=GREEN, $
ENDSTYLE
END
-RUN
-SET &carCtr = &carCtr + 1;
-*-- LOOP2 - End ---------------------------------------------------------------
-LOOP2
-SET &countryCtr = &countryCtr + 1;
-*-- LOOP1 - End -------------------------------------------------------------------------
-LOOP1
-*-- Compound Layout report - End ------------------------------------------------------------------
-* End of Compound Layout syntax goes here
-RUN
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
It looks like the compound pdf doesn't like indexed variables. I get prompt for carCount.&countryCtr when I run it. Before adding compound PDF syntax, I was able to run fine.
-* template-car.fex
SET HOLDLIST=PRINTONLY
SET HOLDFORMAT=ALPHA
SET ASNAMES=ON
SET PAGE=NOLEAD
-RUN
-*-- Prepare data for compound report ----------------------
-INCLUDE CAR-XTR
-*-- Determine the number of countries to process ----------
TABLE FILE HCAR2
SUM COUNTRY
BY COUNTRY
ON TABLE HOLD
END
-RUN
-SET &countryCount = &LINES;
-TYPE ========== countryCount: &countryCount ==========
-*-- Determine the number of cars per country to process ---
TABLE FILE HCAR2
SUM
MAX.CARCNT
BY COUNTRY NOPRINT
ON TABLE SAVE AS HCARCOUNT
END
-RUN
-SET &CTR = 1;
-REPEAT LOOP0 FOR &CTR FROM 1 TO &countryCount
-READ HCARCOUNT &carCount.&CTR.I5.
-TYPE ===== carCount for country &CTR : &carCount.&CTR =====
-LOOP0
-RUN
-SET &countryCtr = 1;
-*-- Compound Layout report - Start ----------------------------------------------------------------
SET HTMLARCHIVE=ON
COMPOUND LAYOUT PCHOLD FORMAT PDF
UNITS=IN, $
SECTION=section1, LAYOUT=ON, METADATA='0.5^0.5^0.5^0.5', MERGE=ON, ORIENTATION=PORTRAIT, PAGESIZE=Letter, $
-*-- LOOP1 - Process each country --------------------------------------------------------
-REPEAT LOOP1 &countryCount TIMES
-TYPE ========== countryCtr: &countryCtr ==========
-SET &LAYOUTNUM = 1;
PAGELAYOUT=&LAYOUTNUM, NAME='Page layout &LAYOUTNUM', text='Page layout &LAYOUTNUM', TOC-LEVEL=1, BOTTOMMARGIN=0.5, TOPMARGIN=1.0, $
COMPONENT='report&countryCtr', TEXT='report&countryCtr', TOC-LEVEL=2, POSITION=(0.5 1.000), DIMENSION=(* *), $
-SET &carCtr = 1;
-*-- LOOP2 - Process each car --------------------------------------------------
-REPEAT LOOP2 &carCount.&countryCtr TIMES
-SET &LAYOUTNUM = &LAYOUTNUM + 1;
-SET &RPTNUM = &carCtr + 1;
-SET &REPORTNUM = &carCtr + 1;
PAGELAYOUT=&LAYOUTNUM, NAME='Page layout &LAYOUTNUM', text='Page layout &LAYOUTNUM', TOC-LEVEL=1, BOTTOMMARGIN=0.5, TOPMARGIN=1.0, $
COMPONENT='report&RPTNUM', TEXT='report&RPTNUM', TOC-LEVEL=2, POSITION=(1 1.000), DIMENSION=(* *), $
COMPONENT='rep&REPORTNUM', TEXT='rep&REPORTNUM', TOC-LEVEL=2, POSITION=(+0.000 +0.0), DIMENSION=(* *), RELATIVE-TO='report&RPTNUM', RELATIVE-POINT=BOTTOM-LEFT, POSITION-POINT=TOP-LEFT, $
-SET &carCtr = &carCtr + 1;
-*-- LOOP2 - End ---------------------------------------------------------------
-LOOP2
-SET &countryCtr = &countryCtr + 1;
-*-- LOOP1 - End -------------------------------------------------------------------------
-LOOP1
END
-SET &countryCtr = 1;
-*-- Compound Layout report - Components - Start----------------------------------------------------------
-*-- RPTLOOP1 - Process each country --------------------------------------------------------
-REPEAT RPTLOOP1 &countryCount TIMES
-TYPE ========== countryCtr: &countryCtr ==========
SET COMPONENT='report&countryCtr'
TABLE FILE HCAR2
SUM SALES
BY COUNTRY NOPRINT
HEADING
"COUNTRY REPORT FOR COUNTRY: <COUNTRY"
BY COUNTRY NOPRINT
WHERE COUNTRYCNT EQ &countryCtr
ON TABLE SET STYLE *
TYPE=REPORT, COLOR=BLUE, STYLE=BOLD, $
ENDSTYLE
END
-RUN
-SET &carCtr = 1;
-*-- RPTLOOP2 - Process each car --------------------------------------------------
-REPEAT RPTLOOP2 &carCount.&countryCtr TIMES
-SET &RPTNUM = &carCtr + 1;
-SET &REPORTNUM = &carCtr + 1;
SET COMPONENT='report&RPTNUM'
TABLE FILE HCAR2
SUM
SALES
DEALER_COST
BY COUNTRY NOPRINT
BY CAR NOPRINT
BY MODEL
HEADING
"REPORT 1 FOR COUNTRY: <COUNTRY / CAR: <CAR"
WHERE COUNTRYCNT EQ &countryCtr
WHERE CARCNT EQ &carCtr
ON TABLE SET STYLE *
TYPE=REPORT, COLOR=RED, $
ENDSTYLE
END
-RUN
SET COMPONENT='rep&REPORTNUM'
TABLE FILE HCAR2
SUM
SALES
RETAIL_COST
BY COUNTRY
BY CAR
BY MODEL
HEADING
"REPORT 2 FOR COUNTRY: <COUNTRY / CAR: <CAR"
WHERE COUNTRYCNT EQ &countryCtr
WHERE CARCNT EQ &carCtr
ON TABLE SET STYLE *
TYPE=REPORT, COLOR=GREEN, $
ENDSTYLE
END
-RUN
-SET &carCtr = &carCtr + 1;
-*-- LOOP2 - End ---------------------------------------------------------------
-RPTLOOP2
-SET &countryCtr = &countryCtr + 1;
-*-- LOOP1 - End -------------------------------------------------------------------------
-RPTLOOP1
-*-- Compound Layout report - End ------------------------------------------------------------------
-* End of Compound Layout syntax goes here
COMPOUND END
-*-COUNTRYLOOP
-RUN
Since the compound PDF syntax doesn't like TABLE FILE or indexed variables in side the loop, I not sure what other options I have. Is that a bug with the COMPOUND PDF code? As some one suggested earlier in the thread, would pre process procedure work? I haven't created any pre process procedure before, but thinking of creating a procedure which creates an external file with no. of cars for each country and reading thru that file ... Any other ideas? Thank you so much.
Where are you running this: "self-service" app, MRE, ReportCaster?
I ran the code exactly as you posted on Jun 12, 2009 09:15 as a fex in an app folder (as a self-service app) and I do not get any prompts for parameters, however I do get this error:
(FOC3296) Error found in Coordinated Compound Report: At Component report2
(FOC3303) Compound report COMPONENT out of order
Compound Report is TERMINATING.....
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
I have used indexed variables in lot of my other reports and I don't get the prompt. Even with this file it runs fine before I add the copound pdf code. I get the prompt after adding the compound pdf code. So, I am not sure whether it's the setting. Thanks.
Francis, Thank you very much for your suggestions. The prompting problem did get fixed by turning IBF_wfdescribe to OFF. We upgraded to 769 and that messed up some of the seetings prompting. I ended up working in my actual report using indexed variable for looping and seems like it's working.