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] Transposing Columns using OVER

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Transposing Columns using OVER
 Login/Join
 
Member
posted
I have some date in this format:

CUSTOMER	SALES	COST
XYZ	1000	600
ABC	2500	1800
 


I want to show it like this:
CUSTOMER		
XYZ	SALES	1000
XYZ	COST	600
ABC	SALES	2500
ABC	COST	1800
  


So, I am using the OVER functions as follows:

quote:
SUM SALES OVER
COST
BY CUSTOMER


But the result is missing to show CUSTOMER in all rows, so it prints like this:
CUSTOMER		
XYZ	SALES	1000
	COST	600
ABC	SALES	2500
	COST	1800
  


Do you have any ideas how I could accomplish this?

Thanks in advance,

Rafael Rangel

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


Rafa
 
Posts: 9 | Location: Memphis, TN | Registered: March 09, 2007Report This Post
Expert
posted Hide Post
Sounds like you're looking for the BYDISPLAY KEYWORD.
 
Posts: 3132 | Location: Tennessee, Nashville area | Registered: February 23, 2005Report This Post
Member
posted Hide Post
It's not that. I already had the option set:
ON TABLE SET BYDISPLAY ON 

Any other ideas?


Rafa
 
Posts: 9 | Location: Memphis, TN | Registered: March 09, 2007Report This Post
Expert
posted Hide Post
By "ACCOUNT", do you mean "CUSTOMER" (ABC, XYZ)?
I'm not particularly proud of this one. But, try it on for size:
TABLE FILE CAR
SUM CAR AS ''
    SALES AS 'SALES' OVER
    CAR AS ''
    RCOST AS 'COST' 
BY CAR NOPRINT
ON TABLE SET BYDISPLAY ON 
END
 
Posts: 3132 | Location: Tennessee, Nashville area | Registered: February 23, 2005Report This Post
Virtuoso
posted Hide Post
Yes.

-* CREATE SAMPLE DATA
TABLE FILE CAR
PRINT COUNTRY
AND COMPUTE
LIST/I5=LIST+1;
CUST/A12 = DECODE LIST(1 XYZ 2 ABC ELSE '');
SALES/D12=DECODE LIST(1 1000 2 600 ELSE 00);
COST /D12=DECODE LIST(1 2500 2 1800 ELSE 00);
IF TOTAL CUST NE ' '
ON TABLE HOLD AS DATA
END

-* Make sales and cost into separate records
DEFINE FILE DATA
TYPE1/A10='SALES';
TYPE2/A10='COST';
END

MATCH FILE DATA
BY CUST
BY TYPE1 AS TYPE
BY SALES AS VALUE
RUN
FILE DATA
BY CUST
BY TYPE2 AS TYPE
BY COST AS VALUE
AFTER MATCH HOLD OLD-OR-NEW
END

-* LIST
TABLE FILE HOLD 
PRINT VALUE 
BY HIGHEST CUST 
BY HIGHEST TYPE
ON TABLE SET BYDISPLAY ON 
END


- Jack Gross
WF through 8.1.05
 
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005Report This Post
Gold member
posted Hide Post
Hi Rafa

TABLE FILE CAR
PRINT SALES
BY CUSTOMER
ON CUSTOMER SUBFOOT
CUSTOMER COST
...
TYPE=SUBFOOT, HEADALIGN=BODY,$

Try that and not using the over will give you more control over formatting


WebFOCUS 8103, Windows, App Studio
 
Posts: 80 | Location: NYC | Registered: November 13, 2008Report This Post
Virtuoso
posted Hide Post
Rafa,

Using a bit of FOCUS trickery:

  
-* File rafa1.fex
-* Create titles
-*
DEFINE FILE CAR
TRCOST/A12='RETAIL';
TDCOST/A12='DEALER';
END
-* Create a SAVE file containing data and titles
-* Note taking advantage that RCOST and DCOST have the same format. If not use the DEFINE above to make them the same
-*
TABLE FILE CAR
PRINT TRCOST RCOST TDCOST DCOST
BY CAR
ON TABLE HOLD AS RAFA FORMAT ALPHA
END
-*
-* Create a Master for RAFA. 
-* Note that title and data are defined once with multiple occurences
-*
EX -LINES 7 EDAPUT MASTER,RAFA,C,MEM
 FILENAME=RAFA    , SUFFIX=FIX
 SEGMENT=RAFA, SEGTYPE=S0
 FIELDNAME=CAR,  ALIAS=CAR,  USAGE=A16, ACTUAL=A16, $
 SEGMENT=COST, PARENT= RAFA, SEGTYPE=S0, OCCURS=VARIABLE
 FIELDNAME=TT,   ALIAS=TT,   USAGE=A12, ACTUAL=A12, $
 FIELDNAME=COST, ALIAS=COST, USAGE=D7,  ACTUAL=A07, $
-RUN
-*
-* Output
-*
TABLE FILE RAFA
PRINT CAR
TT AS ''
COST AS ''
END


Daniel
In Focus since 1982
wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF

 
Posts: 1980 | Location: Tel Aviv, Israel | Registered: March 23, 2006Report This Post
Member
posted Hide Post
I followed Jack Gross' suggestion of using a MATCH on a hold file and it worked beautifully!

Daniel, your trickery was a bit too much for me, due to my lack of experience. But it is a clever way to go around it.

Thank you everybody for the suggestions.

Rafa


Rafa
 
Posts: 9 | Location: Memphis, TN | Registered: March 09, 2007Report This Post
Virtuoso
posted Hide Post
Rafa,

This technique is called "the alternate master". It can be very useful. Your example is a relatively simple one.
to learn a bit more about this, I suggest you look at the generated RAFA file. For this, you can comment out the ON TABLE HOLD AS RAFA statement. Insert a ?FF RAFA after the end and insert a -EXIT after the TABLE request. You will then see the generated file. By using "view source" on the output, you can see the original RAFA master and compare it to the one created in the fex.


Daniel
In Focus since 1982
wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF

 
Posts: 1980 | Location: Tel Aviv, Israel | Registered: March 23, 2006Report 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] Transposing Columns using OVER

Copyright © 1996-2020 Information Builders