Focal Point
[CLOSED] Changing column to row, spliting column to row. using BY after or with OVER.

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

November 30, 2010, 02:42 AM
MKS
[CLOSED] Changing column to row, spliting column to row. using BY after or with OVER.
I have a database data as below:

ID |DESC | A_1| A_2 | A_3 | A_4 | A_5|
----------------------------------------------------------------------
1 | FIRST |21 | 22 | 23 | 24 | 25 |
2 |SECOND |32 |33 | 34 |35 | 36 |
--------------------------------------------------------------------------

I WOULD LIKE TO PRINT IT AS

FOR A_1
FIRST ---> 21
SECOND ----> 32

FOR A_2
FIRST ---> 22
SECOND ----> 33

FOR A_3
FIRST ---> 23
SECOND ----> 34

FOR A_4
FIRST ---> 24
SECOND ----> 35

FOR A_5
FIRST ---> 25
SECOND ----> 36


As with little knowledge in reporting and with WebFocus it seams that this simple requirement involves little complication to first split the columns to rows and then use by field to separate it.

But before that i would like to know if there is any simple way/technique to do this?

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


WebFocus 5.2.5
HP-UX(UNIX)
EXCEL, HTML, PDF and OLAP
November 30, 2010, 04:47 AM
<JG>
If you would care to search the forum this sort of thing has been discussed many times ( McGuyver Technique )

However here is a novel approach. (remember Windows and Unix use different end of line characters)

DEFINE  FILE SOURCE
NL/A2= HEXBYT(013,'A1')||HEXBYT(010,'A1');
A_1T/A3='A_1';
A_2T/A3='A_2';
A_3T/A3='A_3';
A_4T/A3='A_4';
A_5T/A3='A_5';
END
TABLE FILE SOURCE
SUM A_1T DESC A_1 NL A_2T  DESC A_2 NL A_3T DESC A_3 NL A_4T  DESC A_4  NL A_5T DESC  A_5
BY DESC NOPRINT
ON TABLE SET HOLDLIST PRINTONLY
ON TABLE HOLD FORMAT ALPHA
END
-RUN
FILEDEF HOLD DISK HOLD.FTM (LRECL 11
-RUN
EX -LINES 6 EDAPUT MASTER,hold,CV,FILE
FILENAME=HOLD, SUFFIX=FIX,$
SEGNAME=ONE, SEGTYPE=S1 ,$
  FIELD=COL  ,ALIAS=  ,A3 ,A3 ,$ 
  FIELD=DESC  ,ALIAS=  ,A6 ,A6 ,$ 
  FIELD=VALUE  ,ALIAS=  ,I2 ,A2 ,$
-RUN
TABLE FILE HOLD
PRINT  DESC AS ''   VALUE AS ''
BY COL NOPRINT
ON COL SUBHEAD
"For <COL"
ON COL SUBFOOT
" "
ON TABLE SET PAGE NOLEAD
ON TABLE SET STYLE *
GRID=OFF,$
ENDSTYLE
END