On Friday 15 February 2002 10:57, Leif Jensen wrote:
> Hi there,
>
> I have been using psql's HTML option for quite some time to generate
> intranet tables from our corporate database, which works very nicely.
>
> I wonder if anyone has been extending this feature for better control of
> the output. At the moment I am piping output through several 'sed's to
> control table attributes like bgcolor, alignment, etc. It's very difficult
> to control individual columns, using colgroups, etc. this way. I would
> like some kind of additional options making it possible to add table
> attributes as well as making layout control easier.
>
> I have been thinking of having a look at the psql source for adding such
> features if they don't already exists, and I would welcome any suggestions
> in this respect !
How about this idea: A more general HTML report generation program, that
happens to come with a PSQL backend to start with (perhaps it should be write
in Java or PHP or something?) but isn't really Postgres specific, that allows
the user to set up a SELECT (just a text box will be fine, it's really tricky
to write a GUI for that kind of thing a la Access) then provide HTML snippets
for:
1) Header, including the <TABLE> element - defaults to
<HTML><HEAD><TITLE>$TITLE$</TITLE></HEAD><BODY><TABLE>
2) Start of column name row - defaults to <TR>
3) Column name cells - defaults to <TH>$HEADING$</TH>
4) End of column name row - defaults to </TR>
5) Start of data row - <TR>
6) Data cell - <TD>$DATA</TD>
7) End of data row - </TR>
8) Footer - </TABLE></BODY></HTML>
With time, it can be extended to:
1) Have a simple conditional thing so alternate rows can be coloured
differently to make the rows easier to follow, negative numbers can come out
in red, etc
2) Do some aggregration, like adding TOTAL, without having to do a seperate
SELECT SUM(foo) and stitch it into the table
3) Group by the primary sort key for a SORTed query, then producing a single
cell with a ROWSPAN for each distinct value of that field
4) Break the result into pages
5) Produce charts
etc...
Any takers?
>
> Leif
>
ABS
--
Alaric B. Snell, Developer
abs@frontwire.com