I was wondering what would be the easiest way to take columns and pivot them into rows in the Report Builder in Developer Studio? Below is an example of the issue:
Year Period Values ------ ------- ------- 2016 Period1 456,123 2016 Period2 789,456 2016 Period3 123,456 2016 Period4 456,789
WebFOCUS 8 Windows, All Outputs
November 09, 2016, 02:54 PM
dhagen
If the source data is a flat file, you can create an alternate master and put a segment with OCCURS in it.
"There is no limit to what you can achieve ... if you don’t care who gets the credit." Roger Abbott
November 09, 2016, 05:41 PM
RMM
Not a flat file. DB2 source.
WebFOCUS 8 Windows, All Outputs
November 10, 2016, 02:53 AM
Dave
TABLE FILE
_____________________ WF: 8.0.0.9 > going 8.2.0.5
November 10, 2016, 03:19 AM
Tony A
Using one of the sample files (in this case GGSALES) -
DEFINE FILE GGSALES
MONTH/M = DATE;
YEAR/YY = DATE;
Period1/D12C = IF MONTH FROM 1 TO 3 THEN DOLLARS ELSE 0;
Period2/D12C = IF MONTH FROM 4 TO 6 THEN DOLLARS ELSE 0;
Period3/D12C = IF MONTH FROM 7 TO 9 THEN DOLLARS ELSE 0;
Period4/D12C = IF MONTH FROM 10 TO 12 THEN DOLLARS ELSE 0;
END
TABLE FILE GGSALES
SUM YEAR AS '' Period1 AS 'Period1'
OVER YEAR AS '' Period2 AS 'Period2'
OVER YEAR AS '' Period3 AS 'Period3'
OVER YEAR AS '' Period4 AS 'Period4'
BY YEAR NOPRINT
WHERE YEAR EQ 1996
ON TABLE SET PAGE NOLEAD
ON TABLE SET STYLE *
grid=off, $
ENDSTYLE
END
T
In FOCUS since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2
WebFOCUS App Studio 8.2.06 standalone on Windows 10
November 10, 2016, 07:34 AM
Danny-SRL
RMM, You can still use the alternate master technique if you don't mind a HOLD:
-* File rmm01.fex
-* Hold the data and create fields for the names of the periods
TABLE FILE ttt
PRINT
YEAR
Period1
COMPUTE P1/A8='Period1';
Period2
COMPUTE P2/A8='Period2';
Period3
COMPUTE P3/A8='Period3';
Period4
COMPUTE P4/A8='Period4';
ON TABLE HOLD AS RMM FORMAT ALPHA
END
-RUN
-*Create an alternate master in memory
EX -LINES 7 EDAPUT MASTER,RMM,C,MEM
FILENAME=RMM, SUFFIX=FIX
SEGNAME=RMM, SEGTYPE=S0
FIELDNAME=YEAR, FORMAT=YY, ACTUAL=A4, $
SEGNAME=P, PARENT=RMM, OCCURS=VARIABLE
FIELDNAME=VALUES, FORMAT=D6, ACTUAL=A6, $
FIELDNAME=PERIOD, FORMAT=A8, ACTUAL=A8, $
-RUN
-* Produce the output
TABLE FILE RMM
PRINT YEAR PERIOD VALUES
END
I don't know the formats of Year and Period1..4. I did some assumptions.
Daniel In Focus since 1982 wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF
November 10, 2016, 09:28 AM
Kevin Patterson
I realize this is minimally helpful, but I remember seeing something at the last WebFOCUS user group where you are able to use ACROSS vertically.
So if you did: BY YEAR ACROSS PERIOD
Then whatever you have to set to change ACROSS to act vertically should do it... I'm not able to find my notes on that.
Kevin Patterson Appalachian State University WebFOCUS 7.7.03 Windows, All Outputs