Focal Point
[SOLVED] ACROSS Question

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/905109341

June 08, 2009, 12:42 PM
ColdWhiteMilk
[SOLVED] ACROSS Question
I'm having problems getting the "BY" column header to appear on the same line as the "ACROSS" column header values. I need them on the same line so that I my customers can use Auto Filter and sort in Excel.

My code:
TABLE FILE SF86REVIEW2
SUM
ROWTOT AS 'ROWTOT'

BY CLR_ACR_ID AS 'CLR/ACR #'
ACROSS SF86REVIEW2.REJECTER AS ''

WHERE SF86REVIEW2.DAYSRJCT LE 10

ON TABLE PCHOLD FORMAT EXL2K OPEN
END



Gives me:
             AcrossHeader1     AcrossHeader2     AcrossHeader3
ByHeader
Value1             1                 2                 3


What I need:
ByHeader     AcrossHeader1     AcrossHeader2     AcrossHeader3
Value1             1                 2                 3

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


Production - 7.6.4
Sandbox - 7.6.4
June 08, 2009, 01:17 PM
Francis Mariani
This is normal WebFOCUS behaviour.

If you really need to get the column titles in one row, you could use a McGyver technique, though the code isn't pretty:

-SET &ECHO = 'ALL';

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

TABLE FILE CAR
SUM SALES
BY COUNTRY
ACROSS SEATS AS ''
ON TABLE HOLD AS H001
END
-RUN

?FF H001
-RUN

-*-- Create a hold file containing the column names and other attributes of the hold file
CHECK FILE H001 HOLD
-RUN

-*-- Create a hold file containing only the column names generated by the across statement
TABLE FILE HOLD
PRINT FIELDNAME
WHERE FIELDNAME NE 'COUNTRY'
ON TABLE HOLD AS H002
END
-RUN

-*-- Create the report
TABLE FILE H001
PRINT
COUNTRY

-*-- Read the across column name
-READ H002 &FIELDNAME.A66.
-REPEAT END_REP1 WHILE &IORETURN EQ 0;
-*-- Extract the across column value
-SET &FIELDVALUE = SUBSTR(66, &FIELDNAME, 4, 5, 1, 'A1');

-*-- display the across column name and value
&FIELDNAME AS '&FIELDVALUE'

-READ H002 &FIELDNAME.A66.

-END_REP1
END
-RUN


?FF shows what the across column names evaluate to, (in my example SAL1, SAL2, etc) this information is used in the SUBSTR function which extracts the value of the ACROSS field.


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
June 08, 2009, 01:37 PM
ColdWhiteMilk
Is there a way, using the original code I posted, to apply formatting (bold, underline, color, font, etc) to the across column headers?


Production - 7.6.4
Sandbox - 7.6.4
June 08, 2009, 01:43 PM
Francis Mariani
TABLE FILE CAR
SUM
SALES AS 'ROWTOT'

BY COUNTRY AS 'CLR/ACR #'
ACROSS SEATS AS ''

-*ON TABLE PCHOLD FORMAT EXL2K

ON TABLE SET STYLE *
TYPE=TITLE, STYLE=BOLD, $
TYPE=ACROSSVALUE, STYLE=BOLD, $
ENDSTYLE
END



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
June 09, 2009, 07:34 AM
<JG>
The best way to achieve what you want for filtering is by using a template/macro to
move the BY title up 1 row and then delete the blank row that is left.

You can then turn on the auto filtering at the same time.
June 09, 2009, 10:50 AM
ColdWhiteMilk
This is the solution that we came up with:

TABLE FILE SF86REVIEW2
SUM
ROWTOT AS ''
 
BY CLR_ACR_ID

ACROSS SF86REVIEW2.REJECTER
ACROSS-TOTAL AS 'TOTAL'


WHERE SF86REVIEW2.DAYSRJCT LE 60

ON TABLE SET ASNAMES ON
ON TABLE HOLD
END

TABLE FILE HOLD
PRINT *

ON TABLE SET STYLE *
ORIENTATION=LANDSCAPE,$
TYPE=TITLE, COLOR=NAVY, STYLE=BOLD+UNDERLINE, FONT=ARIAL, SIZE=10,$
TYPE=ACROSSVALUE, COLOR=NAVY, STYLE=BOLD+UNDERLINE, FONT=ARIAL, SIZE=10,$
ENDSTYLE

ON TABLE PCHOLD FORMAT EXL2K
END


This gave me all of the column headers on the same row, with the same formatting.


Production - 7.6.4
Sandbox - 7.6.4