March 09, 2007, 02:58 PM
SGAlign Fields in Reports
Is there a way to align fields vertically?
I am creating a fex file and my requirement is as follows:
Field1 Field3 Field4
Field2 Field5
Field6 Field7 Field8 ...........
Thanks,
SG.
March 09, 2007, 03:19 PM
ETTry using over
TABLE FILE FILENAME
PRINT Field1 Field3 Field4
OVER Field2 Field5
OVER Field6 Field7 Field8
END
Good luck
et
March 09, 2007, 04:08 PM
SGHi ET,
works great but the alignment is not what I want.
Everything is towards left. I want to place some fields to the right of the screen and some in the center and some to the left.
Thanks,
SG
March 10, 2007, 04:18 AM
OPALTOSHYou should be able to do the alignment in your stylesheet.
March 10, 2007, 06:55 AM
Alan BHere's an example of utilising OVER in a grid type layout, as OPALTOSH said, using a style sheet to help.
SET LINES=999
DEFINE FILE CAR
DUMMY/A1 = ' ';
HR/A6='<HR>';
END
TABLE FILE CAR
PRINT
COUNTRY AS ''
DUMMY AS ''
DUMMY AS ''
DUMMY AS '' OVER
CAR AS ''
DEALER_COST AS ''
DUMMY AS ''
DUMMY AS '' OVER
MODEL AS ''
RETAIL_COST AS ''
SALES AS ''
DUMMY AS ''
BY COUNTRY NOPRINT
BY CAR NOPRINT
BY MODEL NOPRINT
BY SALES NOPRINT
ON MODEL SUBFOOT
"<HR "
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT HTML
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
UNITS=PTS,
SQUEEZE=OFF,
ORIENTATION=PORTRAIT,
$
TYPE=REPORT,
GRID=OFF,
FONT='TIMES NEW ROMAN',
SIZE=10,
COLOR='BLACK',
BACKCOLOR='NONE',
STYLE=NORMAL,
$
TYPE=REPORT,
COLUMN=P1,
WIDTH=30,
JUSTIFY=LEFT,
$
TYPE=REPORT,
COLUMN=P2,
WRAP=200,
JUSTIFY=RIGHT,
$
TYPE=REPORT,
COLUMN=P3,
WRAP=200,
JUSTIFY=RIGHT,
$
TYPE=REPORT,
COLUMN=P4,
WRAP=10,
$
TYPE=REPORT,
COLUMN=P9,
JUSTIFY=RIGHT,
$
ENDSTYLE
END
Basically, I set up a report with GRID=ON, and fill in empty matrix cells with a field DUMMY to ensure better alignment (not strictly necessary but it does seem to help). I set the width of the columns in the top row, using WIDTH or WRAP, whichever works better. There is an extra column on the end to ensure that the horizontal rule, the
<HR>
,goes further than almost the end of column 3. After complete, turn GRID=OFF.
Basically play with this code to get a feel for what you can do before turning your atttention to your real report.