Search these areas:
Help
Support Forums
Product Info



-Introduction
-DataWeb: What's New
-Creating an Application
-The DataWeb Designer
-Application Management
-Data Tables
-Data Tables
-Views
-Templates
-Components
-Data Analysis
-Members
-Security
-Importing
-Exporting
-FTP
-JavaScript
-Object Model
-Full-Text Search
-Domain and Email Hosting
-HotBlock Modules
-Account Management
-Glossary
-New Responsive UI Module





DataWeb Help
Support Forums
Tutorial
Script Library
Knowledge Base

Home > Support

Script Library

  Output a resultset as an HTML table
 
  chubbard posted this script:
  This script outputs a resultset as an HTML table. It's a quick way to check the contents of your resultset.

public function outputAsHTMLTable(rs)
{
    var aFields = new Array();

    try
        {
        aFields = rs.getFieldList();
        }
    catch(e)
        {
        response.write("You must pass a valid Resultset object to the outputAsHTMLTable() function.");
        return;
        }

    <ws:tags><table border=1><tr></ws:tags>;

    //output field names
    for(var i = 0; i < aFields.length; i++)
        {
        <ws:tags><td><%=aFields[i]%></td></ws:tags>;
        }

    <ws:tags></tr></ws:tags>;
    while(rs.next())
        {
        <ws:tags><tr></ws:tags>;

        for(i = 0; i < aFields.length; i++)
            <ws:tags><td><%=rs[aFields[i]]%></td></ws:tags>;
        <ws:tags></tr></ws:tags>;
        }

    <ws:tags></table></ws:tags>;
}
 
Affiliate | Partner | Terms of Use | Privacy Policy | Contact Us | Pricing | Bring DataWeb In-House    
DataWeb, 720 North 10th Street, A #145, Renton, Washington 98057 *425-583-5970* Fax 484-770-4706* Email Us