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     [CLOSED] Grouping ACROSS columns

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[CLOSED] Grouping ACROSS columns
 Login/Join
 
Member
posted
how can we group across columns?

Required:

BMW Audi Jaguar BMW Audi Jaguar
Model DCOST DCOST DCOST RCOST RCOST RCOST
----- ------ ---- ----- ----- ----- -------
----- ------ ---- ----- ----- ----- -------


original code:

TABLE FILE CAR
SUM
DCOST
RCOST
ACROSS CAR
BY MODEL
END

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


WebFOCUS 7.6
Windows, All Outputs
 
Posts: 21 | Registered: October 20, 2011Report This Post
Virtuoso
posted Hide Post
It's a bit of awkward code, but it has the desired ersult for the given example.
It may of may not work for you in real life.... but here it is:
TABLE FILE CAR
SUM DCOST
COMPUTE SORT/I2 = 1;
COMPUTE SORTNAME/A5='DCOST';
BY CAR
BY MODEL
WHERE CAR EQ 'AUDI' OR 'BMW' OR 'JAGUAR ';
ON TABLE HOLD AS KEEP
END
FILEDEF KEEP DISK KEEP.FTM (APPEND
TABLE FILE CAR
SUM RCOST
COMPUTE SORT/I2 = 2;
COMPUTE SORTNAME/A5='RCOST';
BY CAR
BY MODEL
WHERE CAR EQ 'AUDI' OR 'BMW' OR 'JAGUAR ';
ON TABLE HOLD AS KEEP
END

TABLE FILE KEEP
SUM RE
BY MODEL
ACROSS SORT NOPRINT
ACROSS CAR
ACROSS SORTNAME AS ''
END


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
 
Posts: 1961 | Location: Netherlands | Registered: September 25, 2007Report This Post
Gold member
posted Hide Post
This is similar to GamP's way but uses the MORE statment instead of APPEND and the DCOST and RCOST are above the CARs.

DEFINE FILE CAR
CUR_COST/D20=DCOST;
CUR_SORT/A63='DCOST';
END
TABLE FILE CAR
SUM
CUR_COST
CUR_SORT
BY MODEL
BY CAR
WHERE CAR EQ 'AUDI' OR 'BMW' OR 'JAGUAR ';
ON TABLE HOLD AS KEEP
END

DEFINE FILE CAR
CUR_COST/D20=RCOST;
CUR_SORT/A63='RCOST';
END
TABLE FILE CAR
SUM
CUR_COST AS ''
ACROSS CUR_SORT AS ''
ACROSS CAR
BY MODEL
WHERE CAR EQ 'AUDI' OR 'BMW' OR 'JAGUAR ';
MORE
FILE KEEP
END


WF: 8201, OS: Windows, Output: HTML, PDF, Excel
 
Posts: 78 | Registered: November 08, 2010Report This Post
Virtuoso
posted Hide Post
Or with an alternate master:
  
-SET &ECHO=ALL;
-* File keerthi01.fex
TABLE FILE CAR
SUM
COMPUTE S1/A6='DEALER';
DCOST
COMPUTE S2/A6='RETAIL';
RCOST
BY CAR
BY COUNTRY
ON TABLE HOLD AS KEERTHI FORMAT ALPHA
END
-RUN
EX -LINES 8 EDAPUT MASTER,KEERTHI,C,MEM 
FILENAME=KEERTHI , SUFFIX=FIX 
SEGMENT=KEERTHI, SEGTYPE=S0
 FIELDNAME=CAR, ALIAS=E01, USAGE=A16, ACTUAL=A16, $
 FIELDNAME=COUNTRY, ALIAS=E02, USAGE=A10, ACTUAL=A10, $
SEGMENT=COST, PARENT=KEERTHI, OCCURS=VARIABLE
 FIELDNAME=S, ALIAS=E03, USAGE=A6, ACTUAL=A06, $
 FIELDNAME=COST, ALIAS=E04, USAGE=D7, ACTUAL=A07, $
-RUN
TABLE FILE KEERTHI
SUM COST
ACROSS S AS ''
ACROSS CAR
BY COUNTRY
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
Thanks you. That was exactly what I was looking for. but I have a small issue now. My report is actually an AHTML report and I was wondering on how we can supress the unwanted column title.

TABLE FILE KEERTHI
SUM COST AS ''
ACROSS S AS ''
ACROSS CAR
BY COUNTRY
ON TABLE PCHOLD FORMAT AHTML
END

I tried giving a blank alias name for COST column but however it shows up as column1 , column 2..etc in the report.

Appreciate your help.

Thanks,
Keerthi


WebFOCUS 7.6
Windows, All Outputs
 
Posts: 21 | Registered: October 20, 2011Report This Post
Member
posted Hide Post
Thanks Crymsyn. One question though, is there a way to remove the extra line in the title?

DEFINE FILE CAR
CUR_COST/D20=DCOST;
CUR_SORT/A63='DCOST';
END
TABLE FILE CAR
SUM
CUR_COST
CUR_SORT
BY MODEL
BY CAR
WHERE CAR EQ 'AUDI' OR 'BMW' OR 'JAGUAR ';
ON TABLE HOLD AS KEEP
END

DEFINE FILE CAR
CUR_COST/D20=RCOST;
CUR_SORT/A63='RCOST';
END
TABLE FILE CAR
SUM
CUR_COST AS '&|nbsp'
ACROSS CUR_SORT AS ''
ACROSS CAR AS ''
BY MODEL
WHERE CAR EQ 'AUDI' OR 'BMW' OR 'JAGUAR ';
ON TABLE PCHOLD FORMAT AHTML
MORE
FILE KEEP
END

when I use the above code, I get an extra line in column title...
any help is greatly appreciated.

Thanks,
Keerthi


WebFOCUS 7.6
Windows, All Outputs
 
Posts: 21 | Registered: October 20, 2011Report This Post
Virtuoso
posted Hide Post
The MacGyver technique may offer another solution:

JOIN CLEAR *
JOIN BLANK WITH BODYTYPE IN CAR TO BLANK IN FSEQ AS J1
-*
DEFINE FILE CAR
 BLANK/A1 WITH BODYTYPE = ' ';
 COSTX/D8S = IF (FSEQ.COUNTER EQ 1) THEN DEALER_COST ELSE RETAIL_COST ;
 TYPEX/A5  = IF (FSEQ.COUNTER EQ 1) THEN 'DCost' ELSE
             IF (FSEQ.COUNTER EQ 2) THEN 'RCost' ELSE '';
END
-*
TABLE FILE CAR
 SUM COSTX AS '&|nbsp;'
 BY  MODEL
 ACROSS TYPEX AS ''
 ACROSS CAR   AS ''
 WHERE CAR EQ 'AUDI' OR 'BMW' OR 'JAGUAR';
 WHERE (TYPEX NE '');
 ON TABLE COLUMN-TOTAL
 ON TABLE SET NODATA ''
 ON TABLE PCHOLD FORMAT AHTML
END

This message has been edited. Last edited by: Dan Satchell,


WebFOCUS 7.7.05
 
Posts: 1213 | Location: Seattle, Washington - USA | Registered: October 22, 2007Report This Post
Expert
posted Hide Post
quote:
I get an extra line in column title...
Are you talking about the grid lines? If so, consider adding this:
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
GRID=OFF, BORDER=LIGHT, FONT=ARIAL, SIZE=12,$
ENDSTYLE
 
Posts: 3132 | Location: Tennessee, Nashville area | Registered: February 23, 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     [CLOSED] Grouping ACROSS columns

Copyright © 1996-2020 Information Builders