Focal Point Banner


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.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] Compound Report - breakdown of tables

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Compound Report - breakdown of tables
 Login/Join
 
Member
posted
I'd like to develop a compound report, which consists of several pieces, which seems possible at first sight.
In this report, a user has to choose a country. For this country, I'd like to see:
- The specifications for every single carmodel
- The salesfigures for every single carmodel

Obviously, WebFOCUS tend to print ALL specifications first for ALL models, and then prints ALL salesfigures for ALL carmodels.

How can I enhance the code such, that the compound report is broken down and prints correctly per carmodel? The Code:
[

-* File Car_compound.fex
SET COMPOUND = OPEN NOBREAK
TABLE FILE CAR
BY CAR NOPRINT
ON TABLE SUBHEAD
"Detail information for country "text"
"text"
" "
WHERE COUNTRY EQ 'JAPAN';
ON TABLE SET PAGE-NUM OFF
ON TABLE PCHOLD FORMAT PDF
END

-* Report 1

TABLE FILE CAR
SUM
SEATS
DEALER_COST
BY CAR NOPRINT PAGE-BREAK
BY MODEL
WHERE COUNTRY EQ 'JAPAN';
HEADING
"Specifications for model "text "
"text "
""
FOOTING
"text about this car"
ON TABLE SET PAGE-NUM OFF
ON TABLE PCHOLD FORMAT PDF
END

-* Report 2

SET COMPOUND = CLOSE
TABLE FILE CAR
SUM
RETAIL_COST
SALES
BY CAR NOPRINT PAGE-BREAK
BY MODEL
WHERE COUNTRY EQ 'JAPAN';
HEADING
"Sales figures for model FOOTING
"Rundate <+0>&DATED<+0>-<+0>&DATEM<+0>-<+0>&DATEYY<+0> om <+0>&TOD"
ON TABLE SET PAGE-NUM OFF
ON TABLE PCHOLD FORMAT PDF CLOSE
END
]

This message has been edited. Last edited by: Kerry,


WebFOCUS 7.6.9
 
Posts: 2 | Registered: February 28, 2012Report This Post
Expert
posted Hide Post
If you need to merge the sales figures with the specifications, then I can think of two ways to do this.

1. Create a loop with Dialog Manager inside the compound report, so each part only reports on the same level of data.

2. Use co-ordinated compound report, this has an option to merge on the highest sort field.

Depending on how simple the data is, you may be able to get away with joining you data together and use a single TABLE FILE with appropriate SUBHEADs ad SUBFOOTs.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
Gold member
posted Hide Post
This isn't the nicest looking since getting the columns named will be difficult but is a way. It uses the MacGyver master file to duplicate rows.

Also making a hold file before is not needed unless like in this case is more than one data path like this example with CAR is.

* File Car_compound.fex
-SET &COUNTRY='JAPAN';

TABLE FILE CAR
SUM
SEATS
RETAIL_COST
DEALER_COST
SALES
BY CAR
BY MODEL
ON TABLE HOLD AS CARHOLD
END

-*MacGyver 
FILEDEF MCGMAS DISK MACGYVER.MAS
FILEDEF MCGDAT DISK MACGYVER.DAT
-RUN
-WRITE MCGMAS FILE=MACGYVER,SUFFIX=FOC
-WRITE MCGMAS SEGNAME=MAC1,SEGTYPE=S1
-WRITE MCGMAS   FIELD=BLANK  ,     ,A1,INDEX=I,$
-WRITE MCGMAS SEGNAME=MAC2,SEGTYPE=S1,PARENT=MAC1
-WRITE MCGMAS   FIELD=COUNTER,ORDER,I4,$
-RUN

-*Replace the 2 in the line: FIXFORM 2(CTR/4 X-4) : To increase how many duplicate lines
 CREATE FILE MACGYVER
 MODIFY FILE MACGYVER
 COMPUTE CTR/I9=;
 FIXFORM 2(CTR/4 X-4)
 COMPUTE
   BLANK=' ';
   COUNTER=IF COUNTER EQ 0 THEN CTR ELSE COUNTER+1;
 MATCH BLANK
    ON MATCH CONTINUE
    ON NOMATCH INCLUDE
 MATCH COUNTER
    ON MATCH CONTINUE
    ON NOMATCH INCLUDE
 DATA
1
 END
-RUN

JOIN
BLANK WITH CAR IN CARHOLD TO
BLANK IN MACGYVER AS B_
END

DEFINE FILE CARHOLD
BLANK/A1 WITH CAR=' ';

COLUMN_ONE/I7=IF COUNTER EQ 1 THEN SEATS ELSE RETAIL_COST;
COLUMN_TWO/I7=IF COUNTER EQ 1 THEN DEALER_COST ELSE SALES;
END

TABLE FILE CARHOLD
PRINT
COLUMN_ONE
COLUMN_TWO

BY COUNTER NOPRINT
BY CAR NOPRINT
BY MODEL

ON COUNTER SUBHEAD
"Specifications for model"
"text "
""
WHEN COUNTER EQ 1;

ON COUNTER SUBHEAD
"Sales figures for model "
WHEN COUNTER EQ 2;

ON COUNTER SUBFOOT
""

HEADING
"Detail information for country &COUNTRY"
"text"
" "
FOOTING
"Rundate <+0>&DATED<+0>-<+0>&DATEM<+0>-<+0>&DATEYY<+0> om <+0>&TOD"
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE PCHOLD FORMAT PDF
END
-EXIT


WF: 8201, OS: Windows, Output: HTML, PDF, Excel
 
Posts: 78 | Registered: November 08, 2010Report This Post
Member
posted Hide Post
Thanks for your solutions. The loop option was the answer, we created this code. As you can mention the tricky part was to close the pdf document as the last record was read, so this is a variable line. Case is closed!

-SET &COUNTRY = 'JAPAN'

TABLE FILE CAR
PRINT
MODEL
BY MODEL NOPRINT
WHERE COUNTRY EQ '&COUNTRY';
ON TABLE HOLD AS HLD_FILE1 FORMAT ALPHA
END

-RUN
-SET &TELLER = 1;
-SET &AANT_LOOP = &LINES;


SET COMPOUND = OPEN NOBREAK
TABLE FILE CAR
BY CAR NOPRINT
WHERE COUNTRY EQ '&COUNTRY';
ON TABLE SUBHEAD
"Detail information for country "text"
"text"
" "
ON TABLE SET PAGE-NUM OFF
ON TABLE PCHOLD FORMAT PDF
END


-REPEAT :LEES_MODEL &AANT_LOOP TIMES
-READ HLD_FILE1 &MODEL.A24.
-TYPE &MODEL

-SET &VAR_CMP = IF &TELLER EQ &AANT_LOOP THEN CLOSE ELSE OPEN;

-* Report 1

TABLE FILE CAR
SUM
SEATS
DEALER_COST
BY CAR NOPRINT PAGE-BREAK
BY MODEL
WHERE MODEL EQ '&MODEL';
WHERE COUNTRY EQ '&COUNTRY';
HEADING
"Specifications for model "text "
"text "
""
FOOTING
"text about this car"
ON TABLE SET PAGE-NUM OFF
ON TABLE PCHOLD FORMAT PDF
END

-* Report 2

SET COMPOUND = &VAR_CMP
TABLE FILE CAR
SUM
RETAIL_COST
SALES
BY CAR NOPRINT PAGE-BREAK
BY MODEL
WHERE MODEL EQ '&MODEL';
WHERE COUNTRY EQ '&COUNTRY';
HEADING
"Sales figures for model FOOTING
"Rundate <+0>&DATED<+0>-<+0>&DATEM<+0>-<+0>&DATEYY<+0> om <+0>&TOD"
ON TABLE SET PAGE-NUM OFF
ON TABLE PCHOLD FORMAT PDF

END

-SET &TELLER = &TELLER + 1;
-:LEES_MODEL


WebFOCUS 7.6.9
 
Posts: 2 | Registered: February 28, 2012Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] Compound Report - breakdown of tables

Copyright © 1996-2020 Information Builders