Top  | Previous | Next

system.dataset.dataSetToHTML

Description

Formats the contents of a dataset as an HTML page, returning the results as a string. Uses the <table> element to create a data table page.

Syntax

system.dataset.dataSetToHTML(showHeaders, dataset, title)

Parameters

boolean showHeaders - If true(1), the HTML table will include a header row.

Dataset dataset - The dataset to export

String title - The title for the HTML page.

Returns

String - The HTML page as a string.

Scope

All

Examples

This snippet would run a SQL query against a database, and turn the results into a string containing HTML. It then writes the string to a file on the local hard drive.

 

results = system.db.runQuery("SELECT * FROM example1 LIMIT 100")

results = system.dataset.toDataSet(results)

html = system.dataset.dataSetToHTML(1, results, "Production Report")

filePath = "C:\\output\\results.html"

system.file.writeFile(filePath, html)

 

See also:

system.dataset.exportHTML