WebFocus, two title columns and merging cells

2.5k Views Asked by At

If i have a table in a WebFocus Raport design

+--------+---------+--------+---------+
| left_1 | right_1 | left_2 | right_2 |
+--------+---------+--------+---------+
| v11    | p11     | v21    | v21     |
+--------+---------+--------+---------+
| v12    | p12     | v22    | v22     |
....

How to do a such table with syllabus column titles:

+-------+-------+-------+-------+
|     One       |     Two       |
+-------+-------+-------+-------+
| left  | right | left  | right |
+-------+-------+-------+-------+
| v11   | p11   | v21   | v21   |
+-------+-------+-------+-------+
| v12   | p12   | v22   | v22   |
....

Thank you

3

There are 3 best solutions below

0
On BEST ANSWER

Sorry for the delay of the answer :)

To rename columns, with the AS command. Example:

TABLE FILE SYSTABLE
PRINT NAME
COMPUTE LEFT1/A3  = 'v11'; AS 'left';
COMPUTE RIGHT1/A3 = 'p11'; AS 'right';
COMPUTE LEFT2/A3  = 'v21'; AS 'left';
COMPUTE RIGHT2/A3 = 'p21'; AS 'right';
IF RECORDLIMIT EQ 10
END

To put the heading columns, you can work with the ACROSS command but it will be more tricky that if u use simply SUBHEAD. With the same example:

TABLE FILE SYSTABLE
PRINT NAME NOPRINT
COMPUTE LEFT1/A3  = 'v11'; AS 'left';
COMPUTE RIGHT1/A3 = 'p11'; AS 'right';
COMPUTE LEFT2/A3  = 'v21'; AS 'left';
COMPUTE RIGHT2/A3 = 'p21'; AS 'right';
IF RECORDLIMIT EQ 10
ON TABLE SUBHEAD
"<+0>One<+0> Two"
ON TABLE PCHOLD FORMAT HTML
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
           UNITS=IN, PAGESIZE='Letter',
           LEFTMARGIN=0.500000,  RIGHTMARGIN=0.500000,
           TOPMARGIN=0.500000,   BOTTOMMARGIN=0.500000,
           SQUEEZE=ON, GRID=OFF, ORIENTATION=LANDSCAPE, $
TYPE=REPORT,FONT='ARIAL',SIZE=9,$
TYPE=TABHEADING,HEADALIGN=BODY,$
TYPE=TABHEADING, LINE=1, ITEM=1, COLSPAN=2, SQUEEZE=ON,$
TYPE=TABHEADING, LINE=1, ITEM=2, COLSPAN=2, SQUEEZE=ON,$
ENDSTYLE
END

Hope it helps!

0
On

I'm not entirely sure if you load the headers as a field or if that is the field name But this might help you

Define fields

TITL1/A3 = 'One';
TITL2/A3 = 'Two';
BLANK/A1 = '';

Edit the Left and Right title fields to remove the _1 or _2

Print the fields BY BLANK NOPRINT Add ON BLANK SUBHEAD "

You can also add more rows to the subhead if you need more titles

0
On

You can easily do it by embedding HTML/CSS scripts in report(.fex) file. just add the HTML/css code at the end of the file. For eg.

-HTMLFORM BEGIN  // to start styling your generated report table with HTML/CSS
TABLE tr 
td:first-child // applies on 1st row ONLY.It can be td or th.
{ 
colspan = "2"; //to merge 2 columns
}
-HTMLFORM END //end HTML.

So the first row must have two cells having title "ONE" and "TWO"(in your case), and both cells must have property of colspan = "2"

Also you can refer:

  1. Colspan propery from here
  2. manipulating first row of table from here

Second option is to write the whole code in a file and save it in .htm/.html format and just insert the file in to WEBFOCUS(.fex) file.For eg.

-HTMLFORM BEGIN
-INCLUDE HTML_FILE.HTML
-HTMLFORM END

Hope it helps.Thanks.