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] Across values within a column + a calculated column

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Across values within a column + a calculated column
 Login/Join
 
Member
posted
I have a report I need to produce that lists last years data, this years data, and a calculation between the two columns. I need those 3 columns to be grouped below the header of the field where the sum values come from. Does anyone any any ideas on how to do that?

Here is a sample I did from the cars data:

TABLE FILE CAR
SUM
DEALER_COST AS 'DEALER'
RETAIL_COST AS 'RETAIL'
BY COUNTRY
BY CAR
ACROSS SEATS
WHERE COUNTRY EQ 'ENGLAND';
END

The ouput from this is:
SEATS
2 4 5
COUNTRY CAR DEALER RETAIL DEALER RETAIL DEALER RETAIL
ENGLAND JAGUAR 7,427 8,878 . . 11,194 13,491
JENSEN . . 14,940 17,850 . .
TRIUMPH 4,292 5,100 . .


I need to output to be like this:
DEALER_COST RETAIL_COST
SEATS SEATS
COUNTRY CAR 2 4 5 2 4 5
ENGLAND JAGUAR 7,427 . 11,194 8,878 . 13,491
JENSEN . 14,940 . . 17,850 .
TRIUMPH 4,292 . . 5,100 . .

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


Carol Bricker
BNSF Railway
Production: WF Dev Studio 7.6.11
Output: HTML, Excel 2010, PDF
 
Posts: 5 | Location: Fort Worth, TX | Registered: June 09, 2006Report This Post
Expert
posted Hide Post
If you put your output between
[code]

[/code]

tags, you could use spaces to line up the report as you'd like it to be, then we may be able to help you out, right now it looks like a jumble of text and numbers.

COUNTRY  SALES
-------  -----
ENGLAND   2301


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
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Member
posted Hide Post
I have a report I need to produce that lists last years data, this years data, and a calculation between the two columns. I need those 3 columns to be grouped below the header of the field where the sum values come from. Does anyone any any ideas on how to do that?

Here is a sample I did from the cars data:

TABLE FILE CAR
SUM
DEALER_COST AS 'DEALER'
RETAIL_COST AS 'RETAIL'
BY COUNTRY
BY CAR
ACROSS SEATS
WHERE COUNTRY EQ 'ENGLAND';
END

The ouput from this is:

		                      SEATS					
		         2		4		5	
COUNTRY	CAR	DEALER	RETAIL	DEALER	RETAIL	DEALER	RETAIL
ENGLAND	JAGUAR	7,427	8,878	.	.	11,194	13,491
	JENSEN	.	.	14,940	17,850	.	.
	TRIUMPH	4,292	5,100	.	.	.	.


I need to output to be like this:
		       DEALER		|      RETAIL		
		        SEATS		|       SEATS		
COUNTRY	CAR	  2	  4	  5	|  2	  4	  5
ENGLAND	JAGUAR	7,427	.	11,194	|8,878	.	13,491
	JENSEN	.	14,940	.	|.	17,850	.
	TRIUMPH	4,292	.	.	|5,100	.	.



Thanks for the help!


Carol Bricker
BNSF Railway
Production: WF Dev Studio 7.6.11
Output: HTML, Excel 2010, PDF
 
Posts: 5 | Location: Fort Worth, TX | Registered: June 09, 2006Report This Post
Expert
posted Hide Post
quote:
I need those 3 columns to be grouped below the header of the field where the sum values come from
I can't figure out what you mean by this. It looks like you want seats 2 4 and 5 repeated twice - another ACROSS before the ACROSS SEATS might do it for you.


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
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Expert
posted Hide Post
One method involves creating intermediary HOLD files and then concatenating them with the MORE FILE command. Here's an example:

SET ASNAMES=ON
SET HOLDLIST=PRINTONLY
SET HOLDFORMAT=ALPHA
SET PAGE=NOLEAD
-RUN

TABLE FILE CAR
SUM
DEALER_COST AS 'COST'
COMPUTE COST_TYPE/A10 = 'DEALER';
BY COUNTRY
BY CAR
BY SEATS
WHERE COUNTRY EQ 'ENGLAND';
ON TABLE HOLD AS HDEALER
END
-RUN

TABLE FILE CAR
SUM
RETAIL_COST AS 'COST'
COMPUTE COST_TYPE/A10 = 'RETAIL';
BY COUNTRY
BY CAR
BY SEATS
WHERE COUNTRY EQ 'ENGLAND';
ON TABLE HOLD AS HRETAIL
END
-RUN

TABLE FILE HDEALER
SUM
COST
BY COUNTRY
BY CAR
ACROSS COST_TYPE AS ''
ACROSS SEATS

ON TABLE SET STYLE *
TYPE=REPORT, SQUEEZE=ON, FONT='ARIAL', SIZE=9, $

ENDSTYLE

MORE
FILE HRETAIL
END

Once you get this to work, you can tackle the headings!


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
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Member
posted Hide Post
For each column, dealer and retail, I need the seats grouped below them instead of the dealer and retail grouped below the seats.

For my actual program I have 15 fields. Each of those fields needs to have values below them representing last year and this year. When I do a normal across I get the two big columns. The first is last year and then shows all of my sum fields below it, the second is this year with all of my sum fields below it.

instead of this:
|---------------|---------------|
|     2010      |      2011     |
| a | b | c | d | a | b | c | d |
|---------------|---------------|
 
I need this:
|---------------------------------------|
|    a    |    b    |    c    |    d    |
|2010|2011|2010|2011|2010|2011|2010|2011|
|---------------------------------------|



Carol Bricker
BNSF Railway
Production: WF Dev Studio 7.6.11
Output: HTML, Excel 2010, PDF
 
Posts: 5 | Location: Fort Worth, TX | Registered: June 09, 2006Report This Post
Expert
posted Hide Post
CVB, the example I just posted does that.


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
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Member
posted Hide Post
quote:
One method involves creating intermediary HOLD files and then concatenating them with the MORE FILE command. Here's an example:


Thank you! This is perfect.

Carol


Carol Bricker
BNSF Railway
Production: WF Dev Studio 7.6.11
Output: HTML, Excel 2010, PDF
 
Posts: 5 | Location: Fort Worth, TX | Registered: June 09, 2006Report This Post
Platinum Member
posted Hide Post
CVB,

You can also use the McGyver method. It produces the exact same output as Francis but with only one pass. Here's the code:

-* Set up McGyver master and data file.
-*
-* Build McGyver MFD
FILEDEF MCMAS DISK MCGYV.MAS
-RUN
-WRITE MCMAS FILENAME=mcgyv, SUFFIX=FIX     , $
-WRITE MCMAS   SEGMENT=ONE, SEGTYPE=S0, $
-WRITE MCMAS     FIELDNAME=CONTROL, USAGE=A1, ACTUAL=A1, $
-WRITE MCMAS   SEGMENT=TWO, SEGTYPE=S0, PARENT=ONE, OCCURS=VARIABLE, $
-WRITE MCMAS     FIELDNAME=CHAR1, USAGE=A1, ACTUAL=A1, $
-WRITE MCMAS     FIELDNAME=CTR, ALIAS=ORDER, USAGE=I4, ACTUAL=I4, $
-*
-* Build McGyver FTM
FILEDEF MCGYV DISK MCGYV.FTM
-RUN
-WRITE MCGYV XAB

-**************************************************************************************
-RUN
JOIN CONTROL WITH BODYTYPE IN CAR TO UNIQUE CONTROL IN MCGYV AS J2
DEFINE FILE CAR
-* Control=X: used as Join cross reference target field
CONTROL      /A1 WITH BODYTYPE='X';
COSTSORT/A6=DECODE CTR(1 DEALER ELSE RETAIL);
COST/D12.2=IF CTR EQ 1 THEN DEALER_COST ELSE RETAIL_COST;
END
TABLE FILE CAR
SUM COST AS ''
ACROSS COSTSORT AS ''
ACROSS SEATS 
BY COUNTRY
BY CAR
WHERE COUNTRY EQ 'ENGLAND'
ON TABLE SET PAGE NOLEAD
ON TABLE PCHOLD FORMAT HTML
ON TABLE SET STYLE *
TYPE=REPORT, SQUEEZE=ON, FONT='ARIAL', SIZE=9, $
ENDSTYLE
END


Hi Francis, a tip of the hat to you. By the way, at Summit in Dallas, you were mentioned by Art Greenhaus during the FocWizards session so your fame is spreading!

David



In FOCUS since 1985 - WF 8.009/8.104 Win 8 Outputs: ALL of 'em! Adapters: Sql Server Teradata Oracle
 
Posts: 161 | Location: Dallas, TX | Registered: February 20, 2009Report This Post
Expert
posted Hide Post
"mentioned by Art Greenhaus during the FocWizards session" - positive mention I hope! Like me, he is one of the old guard - probably not too interested in the new-fangled GUI stuff...


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
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report 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] Across values within a column + a calculated column

Copyright © 1996-2020 Information Builders