I wrote a DisplayInColumns custom tag recently for a project and have found it to be extremely useful. The tag minimally accepts as parameters a query and a formatter and optionally includes the number of columns and table attributes. The formatter is a UDF that is called to format each record in the query–referred to as a callback.
With the DisplayInColumns custom tag we can display a record set of names in three columns with the following code (which includes the sample data).
s = "Andrew,Andy,Ba,Bach,Brad,Chafic,Chau,David,Feng,Jay,Jim,Laura" &
"Lucas,Marilyn,Mindy,Nancy,Oanh,Rosa,Sam,Shelly,Thuy,Wang";
q = queryNew("");
queryAddColumn(q, "name", listToArray(s));
This code does three things.
- It sets up the source data which for demonstration purposes we’re hard coding.
- It creates a myFormatter UDF which formats each record by displaying the record number and the value of the “name” column.
- It calls the DisplayInColumns custom tag to display the data in three columns.
The result of this code follows is this table.
s = “Andrew,Andy,Ba,Bach,Brad,Chafic,Chau,David,Feng,Jay,Jim,Laura” &
“Lucas,Marilyn,Mindy,Nancy,Oanh,Rosa,Sam,Shelly,Thuy,Wang”;
q = queryNew(“”);
queryAddColumn(q, “name”, listToArray(s));
The advantage of this custom tag is that by using a callback UDF it is extremely flexible in presentation. The tag also supports providing attributes for the table elements it creates.
You can view or download the tag.
Hello there,
Iwas browsing the web and found this blog. Some interesting quotes. Keep them coming!
Alice
capital home loans
Hi, You should check out Motrin
Guten Tag – Hier ist ein sehr schooner Site. Cheap Staples
Danke!
Bob Staple
So much spam (