These automaticaly produce an html table

FormatCell | Accessing additional fields | Making a field a link | Tables with 2 columns |


The purpose of a TDataSetTableProduce is to simply create an html table. For each cell of the table, FormatCell is called. The html string will look something like this ie, you can modify CustomAttrs and CellData to produce any html string you want that has that format.

Accessing additional fields

The table producer creates an html table with only those fields/columns that were specified in the table designer. However, sometimes additional fields, (those not explicitly displayed) are used to help format the data.

Each time FormatCell is called, all the fields in the current record are available via

For instance, one of my lookup tables contains html css class definitions that are used to display values in different colors. The query merges the data file with the lookup table, thus providing access to the html code. By setting the CustomAttrs to these strings, the data is appropriately colored.

For example, the following code

is used to to produce table columns like these. This is a portion of the actual style definition - created automatically from the lookup tables (never hard code stuff like this).

Making a field a link

This example uses the CellData to create a link to another page. The target causes the pages to open in another window. This is the resulting html. This example actually produces code that calls a subroutine. This is the resulting html. This is the script - I prefer it in this case because the resulting window looks more like a dialog box than a web browser.

Tables with 2 columns

The TDataSetTableProducer component generates an html table with only one column. This is one method to produce tables with 2 columns. Basically, I create a table with one column in a PageProducer. When the HTML-transparent tag #Table_2_Columns is processed, I call a DataSetTableProducer. The Table Producer calls FormatCell for each field. After half of the rows are processed, this code ends the first table and starts the second table. In this example

Author: Robert Clemenzi -
URL: http:// / user / clemenzi / technical / Databases / Delphi / WebServers / WebServer_DataSetTableProducers.html