Focal Point
[SOLVED] Columns to Rows

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

July 12, 2009, 02:56 PM
Jagadish
[SOLVED] Columns to Rows
I have the following requirement

Resultset will contain 15 columns. Always onlye one row of data

But these 15 columns should be displayed as following

Col1 Value Col6 Value
Col2 Value Col7 Value
Col3 Value Col8 Value
Col4 Value Col9 Value
Col5 Value Col10 Value


Col11 Value
Col12 Value
Col13 Value
Col14 Value
Col15 Value

I can using OVER and putting the data in HTMTABLE format and displaying them in TR and TD tages with HTMLFORM using
!IBI.FIL.HOLDFILENAME

But in order to support multi-version output like XLS CSV and PDF how can I avoid using HTMLFORM and HTMTABLE combination but get the same output.

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


WebFOCUS 7.6
Windows
Excel, HTML, PDF
July 13, 2009, 02:08 AM
Tony A
As it's only one row of data then I would suggest ON TABLE SAVE AS followed by -READing the values in and using them in a heading.

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 
July 13, 2009, 05:24 AM
Jagadish
Thanks for your response.

As I need to format data COL1 VALUE1 COL2 VALUE2, essentially I have to start doing trail and error formatiing right?! Cant really get TR TD type of consistent formatting.


WebFOCUS 7.6
Windows
Excel, HTML, PDF
July 13, 2009, 06:17 AM
Tony A
If you want CSV and PDF output versions then there are no TD and TR tag pairings. Or did you not realise that?

T
July 13, 2009, 09:48 AM
KenFR
Could you concatenate the columns to be displayed next to each other inside a define and then just print them with the OVER?


8105 Tomcat and AIX reporting server
input: Teradata, SQL, DB2, Essbase, Oracle, text
output:html, excel, PDF,
July 13, 2009, 11:27 AM
Jagadish
TD and TR tags are not in CSV and PDF world for sure. I realize that. Probably I didnt phrase the statement correctly.

What I meant is that using the -READ and heading I will not be able to get a precise format in CSV PDF comparable to what I can achive using TR and TD for a HTML format.

I can do the column concatenation in a define and use OVER but to my knowledge I will not be able apply separate style to distinguish them as label and data.

Thanks for all your thoughts to this thread. Any further thoughts?


WebFOCUS 7.6
Windows
Excel, HTML, PDF
July 13, 2009, 03:21 PM
Tony A
You'll not achieve the format you get with HTML in CSV because the latter is a data format and not a display format, therefore you will not be able to use the HEADING idea for that as the HEADING is not retained.

Your answer lies in the history of Focal Point - all the posts and responses laid down since it's inception.

However, as search seems a little too much, think along these lines -

-* Try  each of these in turn
-SET &WFFMT = 'PDF';
-SET &WFFMT = 'CSV';
-SET &WFFMT = 'HTML';

TABLE FILE CAR
SUM COUNTRY NOPRINT
ACROSS COUNTRY
ON TABLE SAVE AS TEMPSAV1
END
-RUN

-READ TEMPSAV1 &Country1.A10. &Country2.A10. &Country3.A10. &Country4.A10. &Country5.A10.

-IF &WFFMT EQ 'CSV' THEN :Label01;

TABLE FILE GGSALES
BY REGION NOPRINT
HEADING
"Country1 <+0> &Country1 <+0> Country4 <+0> &Country4 "
"Country2 <+0> &Country2 <+0> Country5 <+0> &Country5 "
"Country3 <+0> &Country3 "
IF RECORDLIMIT EQ 1
ON TABLE PCHOLD FORMAT &WFFMT
ON TABLE SET HTMLCSS ON
ON TABLE SET PAGE NOLEAD
ON TABLE SET STYLE *
-* Styling as per your needs
ENDSTYLE
END
-RUN

-EXIT

-:Label01
FILEDEF CSVOUT DISK CSVOUT.csv
-RUN
-WRITE CSVOUT Country1,&Country1.EVAL,Country4,&Country4.EVAL
-WRITE CSVOUT Country2,&Country2.EVAL,Country5,&Country5.EVAL
-WRITE CSVOUT Country3,&Country3.EVAL
-RUN

CMD TYPE CSVOUT.csv

All you have to do is exercise the little grey cells

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 
July 16, 2009, 03:23 PM
Jagadish
OVER worked out well.

I used the following

COL1 AS 'COLUMN 1'
COL6 AS 'COLUMN 6' OVER
COL2 AS 'COLUMN 2'
COL7 AS 'COLUMN 7' OVER
COL3 AS 'COLUMN 3'
COL8 AS 'COLUMN 8' OVER
COL4 AS 'COLUMN 4'
COL9 AS 'COLUMN 9' OVER
COL5 AS 'COLUMN 5'
COL10 AS 'COLUMN 10' OVER

Thanks to all for your help.

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


WebFOCUS 7.6
Windows
Excel, HTML, PDF
July 17, 2009, 05:18 AM
Tony A
But OVER will not be retained when you save as a CSV file (FORMAT COM or COMT).

Or do you actually mean Excel format? (FORMAT EXL2K NOT EXCEL) - which will retain the structure of OVER.

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