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]how to generate the compound reports based on dynamic BY field

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED]how to generate the compound reports based on dynamic BY field
 Login/Join
 
Guru
posted
Hi,

Iam trying to generate a compound report one below the other in EXCEL format
based on a BY field(Country).Now as shown in the below example,since I know that there
are only 3 countries in the Car file,so that I can hardcode the values in
the filter condition and generate the report.Also when I run the below code,
I get the 3 reports one below the other without any spacing between one report
and the next.

But when I have to generate the compound report based on a BY field which
is dynamic(say sometimes I may have only 2 country values or sometimes 5 values and so on)....
Please let me know how can I generate the compound reports in this situation
without hardcoding the country values.....

Any suggestions or solutions would help me.....Thanks a lot!

TABLE FILE CAR
SUM
SEATS RETAIL_COST DEALER_COST
BY COUNTRY
WHERE COUNTRY EQ 'ENGLAND'
ON TABLE PCHOLD FORMAT EXL2K OPEN NOBREAK
END

TABLE FILE CAR
SUM
SEATS RETAIL_COST DEALER_COST
BY COUNTRY
WHERE COUNTRY EQ 'FRANCE'
ON TABLE PCHOLD FORMAT EXL2K OPEN NOBREAK
END

TABLE FILE CAR
SUM
SEATS RETAIL_COST DEALER_COST
BY COUNTRY
WHERE COUNTRY EQ 'ITALY'
ON TABLE PCHOLD FORMAT EXL2K CLOSE
END
-EXIT

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


Webfocus 8105 Developer studio,Windows 7,HTML,Excel,PDF,Text,Infoassist,Graph,AHTML
 
Posts: 270 | Registered: October 30, 2014Report This Post
Virtuoso
posted Hide Post
Could be a way

TABLE FILE CAR
BY COUNTRY
-*WHERE RECORDLIMIT EQ 4;
ON TABLE HOLD AS CNTRY FORMAT BINARY
END
-RUN

-IF &LINES EQ 0 THEN GOTO NORPT;
-SET &NBCNTRY = &LINES;
-SET &LOOP    = 1;

-NEXTRPT
-SET &OPT = IF &NBCNTRY EQ &LOOP THEN 'CLOSE' ELSE 'OPEN NOBREAK';

-READFILE CNTRY
-RUN

TABLE FILE CAR
SUM SEATS RETAIL_COST DEALER_COST
BY COUNTRY
ON COUNTRY SUBFOOT
""
WHERE COUNTRY EQ '&COUNTRY.EVAL';
ON TABLE PCHOLD FORMAT EXL2K &OPT
END

-SET &LOOP = &LOOP + 1;
-IF &LOOP LE &NBCNTRY THEN GOTO NEXTRPT;
-GOTO ENDRPT;

-NORPT
-TYPE No Report To Display
-ENDRPT


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
 
Posts: 2409 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013Report This Post
Guru
posted Hide Post
Thanks a lot MartinY....
It helped me !!

Regards!
 
Posts: 270 | Registered: October 30, 2014Report This Post
Virtuoso
posted Hide Post
My pleasure.

Change the subject of your first post to [SOLVED]

Also, update your signature to include your WF setup and version, it may help us to give you a proper solution based on it.


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
 
Posts: 2409 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013Report This Post





That "2486" is my "real" data and the "456234" was just the value used for sorting.

So I had to create a hold file to hold the results of the BY to get unique values in a sorted order. Then print that hold file to a BINARY file.

Here is what that looks like with the CAR example:
TABLE FILE CAR
BY COUNTRY
ON TABLE HOLD FORMAT FOCUS AS CNTRY_SORTED
END

TABLE FILE CNTRY_SORTED
PRINT COUNTRY
ON TABLE HOLD AS CNTRY FORMAT BINARY
END
-RUN

Then you're left with just the data you want (example from my data -- note just one column now):





Also a note to newbies: If you're wondering, like I was, where &COUNTRY came from -READFILE creates it. Find more details on -READFILE in the manual;


Kevin Patterson
Appalachian State University
WebFOCUS 7.7.03
Windows, All Outputs
Gold member
posted Hide Post
Thanks MartinY; this is so clear and easy to follow.

I ran across a couple of things when trying to replicate this with my own data that I think others might find helpful.

When creating the first hold file that you will -READFILE from (CNTRY in this example) FOCUS will create a second field of data to do the sorting if you've used a BY. So the -READFILE operation will pull that field used for sorting as a piece of data to use; which you would not want as it is just some database value used for sorting and not "real" data.

Here is what my data looked like when outputting to XML:
2486 2486
2486
 
Posts: 57 | Registered: February 29, 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]how to generate the compound reports based on dynamic BY field

Copyright © 1996-2020 Information Builders