{div:style=display:none}
DO NOT EDIT THE CONTENT OF THIS PAGE DIRECTLY (EXCEPT INSIDE THE DIV BELOW WITH ID=DESCRIPTION), UNLESS YOU KNOW WHAT YOU'RE DOING.
		THE STRUCTURE OF THE CONTENT IS VITAL IN BEING ABLE TO AUTO UPDATE THE CONTENT THROUGH THE DOC GENERATOR.\\		\\		Enter additional information related to this 'class' inside the \{div} macro with 'id=description'{div}
{div:id=description}{div}\\ 

{table:id=|class=servoy sSummary}{colgroup}{column:width=80px|padding=0px}{column}{column}{column}{colgroup}{tr:style=height: 30px;}{th:colspan=2}Property Summary{th}{tr}{tbody}{tr}{td}[Number]{td}{td}[#rowIndex]
Get or set the record index of the dataset.{td}{tr}{tbody}{table}\\ 

{table:id=|class=servoy sSummary}{colgroup}{column:width=80px|padding=0px}{column}{column}{column}{colgroup}{tr:style=height: 30px;}{th:colspan=2}Method Summary{th}{tr}{tbody}{tr}{td}[Boolean]{td}{td}[#addColumn]\(name)
adds a column with the specified name to the dataset.{td}{tr}{tbody}{tbody}{tr}{td}[Boolean]{td}{td}[#addColumn]\(name, index)
adds a column with the specified name to the dataset.{td}{tr}{tbody}{tbody}{tr}{td}[Boolean]{td}{td}[#addColumn]\(name, index, type)
adds a column with the specified name to the dataset.{td}{tr}{tbody}{tbody}{tr}{td}void{td}{td}[#addHTMLProperty]\(row, col, name, value)
Add an HTML property to an HTML tag produced in getAsHTML().{td}{tr}{tbody}{tbody}{tr}{td}void{td}{td}[#addRow]\(index, array)
Add a row to the dataset.{td}{tr}{tbody}{tbody}{tr}{td}void{td}{td}[#addRow]\(array)
Add a row to the dataset.{td}{tr}{tbody}{tbody}{tr}{td}[String]{td}{td}[#createDataSource]\(name)
Create a data source from the data set with specified name and using specified types.{td}{tr}{tbody}{tbody}{tr}{td}[String]{td}{td}[#createDataSource]\(name, types)
Create a data source from the data set with specified name and using specified types.{td}{tr}{tbody}{tbody}{tr}{td}[String]{td}{td}[#getAsHTML]\()
Get the dataset as an html table, do not escape values or spaces, no multi\_line\_markup, do not add indentation, add column names.{td}{tr}{tbody}{tbody}{tr}{td}[String]{td}{td}[#getAsHTML]\(escape_values)
Get the dataset as an html table, do not escape spaces, no multi\_line\_markup, do not add indentation, add column names.{td}{tr}{tbody}{tbody}{tr}{td}[String]{td}{td}[#getAsHTML]\(escape_values, escape_spaces)
Get the dataset as an html table, no multi\_line\_markup, do not add indentation, add column names.{td}{tr}{tbody}{tbody}{tr}{td}[String]{td}{td}[#getAsHTML]\(escape_values, escape_spaces, multi_line_markup)
Get the dataset as an html table, do not add indentation, add column names.{td}{tr}{tbody}{tbody}{tr}{td}[String]{td}{td}[#getAsHTML]\(escape_values, escape_spaces, multi_line_markup, pretty_indent)
Get the dataset as an html table, add column names.{td}{tr}{tbody}{tbody}{tr}{td}[String]{td}{td}[#getAsHTML]\(escape_values, escape_spaces, multi_line_markup, pretty_indent, add_column_names)
Get the dataset as an html table.{td}{tr}{tbody}{tbody}{tr}{td}[String]{td}{td}[#getAsText]\(column_separator, row_separator, value_delimiter, add_column_names)
Get the dataset as formatted text.{td}{tr}{tbody}{tbody}{tr}{td}[Object]\[]{td}{td}[#getColumnAsArray]\(index)
Get the column data of a dataset as an Array.{td}{tr}{tbody}{tbody}{tr}{td}[String]{td}{td}[#getColumnName]\(index)
Get a column name based on index.{td}{tr}{tbody}{tbody}{tr}{td}[Number]{td}{td}[#getColumnType]\(index)
Get a column type based on index.{td}{tr}{tbody}{tbody}{tr}{td}[ServoyException]{td}{td}[#getException]\()
Get the database exception if an error occurred.{td}{tr}{tbody}{tbody}{tr}{td}[Number]{td}{td}[#getMaxColumnIndex]\()
Get the number of columns in the dataset.{td}{tr}{tbody}{tbody}{tr}{td}[Number]{td}{td}[#getMaxRowIndex]\()
Get the number of rows in the dataset.{td}{tr}{tbody}{tbody}{tr}{td}[Object]\[]{td}{td}[#getRowAsArray]\(index)
Get the row data of a dataset as an Array.{td}{tr}{tbody}{tbody}{tr}{td}[Object]{td}{td}[#getValue]\(row, col)
Get the value specified by row and column position from the dataset.{td}{tr}{tbody}{tbody}{tr}{td}[Boolean]{td}{td}[#hadMoreData]\()
Return true if there is more data in the resultset then specified by maxReturnedRows at query time.{td}{tr}{tbody}{tbody}{tr}{td}[Boolean]{td}{td}[#removeColumn]\(index)
Remove a column by index from the dataset.{td}{tr}{tbody}{tbody}{tr}{td}void{td}{td}[#removeRow]\(row)
Remove a row from the dataset.{td}{tr}{tbody}{tbody}{tr}{td}void{td}{td}[#setColumnName]\(index, columnName)
Set a column name based on index.{td}{tr}{tbody}{tbody}{tr}{td}void{td}{td}[#setValue]\(row, col, obj)
Set the value specified by row and column position from the dataset.{td}{tr}{tbody}{tbody}{tr}{td}void{td}{td}[#sort]\(col, sort_direction)
Sort the dataset on the given column (1\-based) in ascending or descending.{td}{tr}{tbody}{tbody}{tr}{td}void{td}{td}[#sort]\(comparator)
Sort the dataset using the function as comparator.{td}{tr}{tbody}{table}\\ 

{table:id=property|class=servoy sDetail}{colgroup}{column:width=100%|padding=0px}{column}{colgroup}{tr:style=height: 30px;}{th:colspan=1}Property Details{th}{tr}{tbody:id=rowIndex}{tr:id=name}{td}h6.rowIndex{td}{tr}{tr:id=des}{td}{div:class=sIndent}Get or set the record index of the dataset.{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Number]{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
//assuming the variable dataset contains a dataset
//to set the rowIndex:
dataset.rowIndex = 1 //sets the rowIndex to the first row (dataset is 1-based)
//to retrieve the rowIndex of the currently selected row
var currRow = dataset.rowIndex
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{table}\\ 

{table:id=function|class=servoy sDetail}{colgroup}{column:width=100%|padding=0px}{column}{colgroup}{tr:style=height: 30px;}{th:colspan=1}Method Details{th}{tr}{tbody:id=addColumn-String}{tr:id=name}{td}h6.addColumn{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[Boolean]{span}{span:style=font-weight: bold;}addColumn{span}{span}\(name){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}adds a column with the specified name to the dataset.{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[String]} name -- column name.
{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Boolean] -- true if succeeded, else false.{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
//assuming the variable dataset contains a dataset
var success = dataset.addColumn('columnName',1);
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=addColumn-String_Number}{tr:id=name}{td}h6.addColumn{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[Boolean]{span}{span:style=font-weight: bold;}addColumn{span}{span}\(name, index){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}adds a column with the specified name to the dataset.{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[String]} name -- column name.
\{[Number]} index -- column index number between 1 and getMaxColumnIndex().
{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Boolean] -- true if succeeded, else false.{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
//assuming the variable dataset contains a dataset
var success = dataset.addColumn('columnName',1);
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=addColumn-String_Number_Number}{tr:id=name}{td}h6.addColumn{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[Boolean]{span}{span:style=font-weight: bold;}addColumn{span}{span}\(name, index, type){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}adds a column with the specified name to the dataset.{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[String]} name -- column name.
\{[Number]} index -- column index number between 1 and getMaxColumnIndex().
\{[Number]} type -- the type of column, see JSColumn constants.
{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Boolean] -- true if succeeded, else false.{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
//assuming the variable dataset contains a dataset
var success = dataset.addColumn('columnName',1);
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=addHTMLProperty-Number_Number_String_String}{tr:id=name}{td}h6.addHTMLProperty{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}void{span}{span:style=font-weight: bold;}addHTMLProperty{span}{span}\(row, col, name, value){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Add an HTML property to an HTML tag produced in getAsHTML().

For row and col parameters use:
1 = applies to the container
0 = applies to all
>0 = applies to specific cell{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[Number]} row -- row number
\{[Number]} col -- column number
\{[String]} name -- String property name
\{[String]} value -- String property value
{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}void{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
//adds a container property (to TABLE tag)
dataset.addHTMLProperty(-1,-1,'cellspacing','3');
dataset.addHTMLProperty(-1,-1,'style','border-collapse:collapse;'); //to have a single line border

//adds a row property to all rows (to TR tag)
dataset.addHTMLProperty(0,0,'class','text');

//adds a row property to second row (to TR tag)
dataset.addHTMLProperty(2,0,'class','text');

//adds a column property to all 3rd columns (to TD tag)
dataset.addHTMLProperty(0,3,'class','redcolumn') ;

//adds a specific cell property (to TD tag)
dataset.addHTMLProperty(2,4,'color','blue');

scopes.globals.html_field = '<html>'+dataset.getAsHTML()+'</html>';
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=addRow-Number_ObjectArray}{tr:id=name}{td}h6.addRow{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}void{span}{span:style=font-weight: bold;}addRow{span}{span}\(index, array){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Add a row to the dataset.{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[Number]} index -- index to add row (1\-based)
\{[Object]\[]} array -- row data
{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}void{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
//assuming the variable dataset contains a dataset
dataset.addRow(new Array(1,2,3,4,5,6,7,7)); //adds a row with 8 columns
dataset.addRow(2, new Array(1,2,3,4,5,6,7,7)); //adds a row with 8 columns at row 2
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=addRow-ObjectArray}{tr:id=name}{td}h6.addRow{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}void{span}{span:style=font-weight: bold;}addRow{span}{span}\(array){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Add a row to the dataset. The row will be added as the last row.{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[Object]\[]} array -- row data
{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}void{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
//assuming the variable dataset contains a dataset
dataset.addRow(new Array(1,2,3,4,5,6,7,7)); //adds a row with 8 columns
dataset.addRow(2, new Array(1,2,3,4,5,6,7,7)); //adds a row with 8 columns at row 2
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=createDataSource-String}{tr:id=name}{td}h6.createDataSource{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[String]{span}{span:style=font-weight: bold;}createDataSource{span}{span}\(name){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Create a data source from the data set with specified name and using specified types.
The types are inferred from the data if possible.{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[String]} name -- data source name
{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[String] -- String uri reference to the created data source.{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
ds.addColumn('my_id'); // note: use regular javascript identifiers so they can be used in scripting
ds.addColumn('my_label');
var uri = ds.createDataSource('mydata', [JSColumn.INTEGER, JSColumn.TEXT]);
var jsform = solutionModel.newForm(fname, uri, null, true, 300, 300);

var query = 'select customerid, address, city, country  from customers';
var ds2 = databaseManager.getDataSetByQuery('example_data', query, null, 999);
var uri2 = ds2.createDataSource('mydata2'); // types are inferred from query result
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=createDataSource-String_Object}{tr:id=name}{td}h6.createDataSource{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[String]{span}{span:style=font-weight: bold;}createDataSource{span}{span}\(name, types){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Create a data source from the data set with specified name and using specified types.{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[String]} name -- data source name
\{[Object]} types -- array of types as defined in JSColumn
{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[String] -- String uri reference to the created data source.{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
ds.addColumn('my_id'); // note: use regular javascript identifiers so they can be used in scripting
ds.addColumn('my_label');
var uri = ds.createDataSource('mydata', [JSColumn.INTEGER, JSColumn.TEXT]);
var jsform = solutionModel.newForm(fname, uri, null, true, 300, 300);

var query = 'select customerid, address, city, country  from customers';
var ds2 = databaseManager.getDataSetByQuery('example_data', query, null, 999);
var uri2 = ds2.createDataSource('mydata2'); // types are inferred from query result
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=getAsHTML}{tr:id=name}{td}h6.getAsHTML{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[String]{span}{span:style=font-weight: bold;}getAsHTML{span}{span}\(){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Get the dataset as an html table, do not escape values or spaces, no multi\_line\_markup, do not add indentation, add column names.{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[String] -- String html.{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
//gets a dataset based on a query
//useful to limit the number of rows
var maxReturnedRows = 10;
var query = 'select c1,c2,c3 from test_table where start_date = ?';

//to access data by name, do not use '.' or special characters in names or aliases
var args = new Array();
args[0] = order_date //or new Date();
var dataset = databaseManager.getDataSetByQuery(databaseManager.getDataSourceServerName(controller.getDataSource()),query,args,maxReturnedRows);

// gets a dataset with escape values; escape spaces (lines will not wrap); no multi-line markup; with pretty indentation; shows column names
var htmlTable = dataset.getAsHTML(true, true, false, true, true);

//assigns the dataset to a field and sets the display type to HTML_AREA
//assuming the html_field is a global text variable
scopes.globals.html_field = '<html>'+dataset.getAsHTML()+'</html>';

//Note: To display an HTML_AREA field as an HTML page, add HTML tags at the beginning '<html>' and at the end '</html>'.
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=getAsHTML-Boolean}{tr:id=name}{td}h6.getAsHTML{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[String]{span}{span:style=font-weight: bold;}getAsHTML{span}{span}\(escape_values){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Get the dataset as an html table, do not escape spaces, no multi\_line\_markup, do not add indentation, add column names.{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[Boolean]} escape_values -- if true, replaces illegal HTML characters with corresponding valid escape sequences.
{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[String] -- String html.{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
//gets a dataset based on a query
//useful to limit the number of rows
var maxReturnedRows = 10;
var query = 'select c1,c2,c3 from test_table where start_date = ?';

//to access data by name, do not use '.' or special characters in names or aliases
var args = new Array();
args[0] = order_date //or new Date();
var dataset = databaseManager.getDataSetByQuery(databaseManager.getDataSourceServerName(controller.getDataSource()),query,args,maxReturnedRows);

// gets a dataset with escape values; escape spaces (lines will not wrap); no multi-line markup; with pretty indentation; shows column names
var htmlTable = dataset.getAsHTML(true, true, false, true, true);

//assigns the dataset to a field and sets the display type to HTML_AREA
//assuming the html_field is a global text variable
scopes.globals.html_field = '<html>'+dataset.getAsHTML()+'</html>';

//Note: To display an HTML_AREA field as an HTML page, add HTML tags at the beginning '<html>' and at the end '</html>'.
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=getAsHTML-Boolean_Boolean}{tr:id=name}{td}h6.getAsHTML{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[String]{span}{span:style=font-weight: bold;}getAsHTML{span}{span}\(escape_values, escape_spaces){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Get the dataset as an html table, no multi\_line\_markup, do not add indentation, add column names.{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[Boolean]} escape_values -- if true, replaces illegal HTML characters with corresponding valid escape sequences.
\{[Boolean]} escape_spaces -- if true, replaces text spaces with non\-breaking space tags ( ) and tabs by four non\-breaking space tags.
{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[String] -- String html.{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
//gets a dataset based on a query
//useful to limit the number of rows
var maxReturnedRows = 10;
var query = 'select c1,c2,c3 from test_table where start_date = ?';

//to access data by name, do not use '.' or special characters in names or aliases
var args = new Array();
args[0] = order_date //or new Date();
var dataset = databaseManager.getDataSetByQuery(databaseManager.getDataSourceServerName(controller.getDataSource()),query,args,maxReturnedRows);

// gets a dataset with escape values; escape spaces (lines will not wrap); no multi-line markup; with pretty indentation; shows column names
var htmlTable = dataset.getAsHTML(true, true, false, true, true);

//assigns the dataset to a field and sets the display type to HTML_AREA
//assuming the html_field is a global text variable
scopes.globals.html_field = '<html>'+dataset.getAsHTML()+'</html>';

//Note: To display an HTML_AREA field as an HTML page, add HTML tags at the beginning '<html>' and at the end '</html>'.
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=getAsHTML-Boolean_Boolean_Boolean}{tr:id=name}{td}h6.getAsHTML{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[String]{span}{span:style=font-weight: bold;}getAsHTML{span}{span}\(escape_values, escape_spaces, multi_line_markup){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Get the dataset as an html table, do not add indentation, add column names.{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[Boolean]} escape_values -- if true, replaces illegal HTML characters with corresponding valid escape sequences.
\{[Boolean]} escape_spaces -- if true, replaces text spaces with non\-breaking space tags ( ) and tabs by four non\-breaking space tags.
\{[Boolean]} multi_line_markup -- if true, multiLineMarkup will enforce new lines that are in the text; single new lines will be replaced by <br>, multiple new lines will be replaced by <p>
{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[String] -- String html.{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
//gets a dataset based on a query
//useful to limit the number of rows
var maxReturnedRows = 10;
var query = 'select c1,c2,c3 from test_table where start_date = ?';

//to access data by name, do not use '.' or special characters in names or aliases
var args = new Array();
args[0] = order_date //or new Date();
var dataset = databaseManager.getDataSetByQuery(databaseManager.getDataSourceServerName(controller.getDataSource()),query,args,maxReturnedRows);

// gets a dataset with escape values; escape spaces (lines will not wrap); no multi-line markup; with pretty indentation; shows column names
var htmlTable = dataset.getAsHTML(true, true, false, true, true);

//assigns the dataset to a field and sets the display type to HTML_AREA
//assuming the html_field is a global text variable
scopes.globals.html_field = '<html>'+dataset.getAsHTML()+'</html>';

//Note: To display an HTML_AREA field as an HTML page, add HTML tags at the beginning '<html>' and at the end '</html>'.
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=getAsHTML-Boolean_Boolean_Boolean_Boolean}{tr:id=name}{td}h6.getAsHTML{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[String]{span}{span:style=font-weight: bold;}getAsHTML{span}{span}\(escape_values, escape_spaces, multi_line_markup, pretty_indent){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Get the dataset as an html table, add column names.{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[Boolean]} escape_values -- if true, replaces illegal HTML characters with corresponding valid escape sequences.
\{[Boolean]} escape_spaces -- if true, replaces text spaces with non\-breaking space tags ( ) and tabs by four non\-breaking space tags.
\{[Boolean]} multi_line_markup -- if true, multiLineMarkup will enforce new lines that are in the text; single new lines will be replaced by <br>, multiple new lines will be replaced by <p>
\{[Boolean]} pretty_indent -- if true, adds indentation for more readable HTML code.
{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[String] -- String html.{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
//gets a dataset based on a query
//useful to limit the number of rows
var maxReturnedRows = 10;
var query = 'select c1,c2,c3 from test_table where start_date = ?';

//to access data by name, do not use '.' or special characters in names or aliases
var args = new Array();
args[0] = order_date //or new Date();
var dataset = databaseManager.getDataSetByQuery(databaseManager.getDataSourceServerName(controller.getDataSource()),query,args,maxReturnedRows);

// gets a dataset with escape values; escape spaces (lines will not wrap); no multi-line markup; with pretty indentation; shows column names
var htmlTable = dataset.getAsHTML(true, true, false, true, true);

//assigns the dataset to a field and sets the display type to HTML_AREA
//assuming the html_field is a global text variable
scopes.globals.html_field = '<html>'+dataset.getAsHTML()+'</html>';

//Note: To display an HTML_AREA field as an HTML page, add HTML tags at the beginning '<html>' and at the end '</html>'.
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=getAsHTML-Boolean_Boolean_Boolean_Boolean_Boolean}{tr:id=name}{td}h6.getAsHTML{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[String]{span}{span:style=font-weight: bold;}getAsHTML{span}{span}\(escape_values, escape_spaces, multi_line_markup, pretty_indent, add_column_names){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Get the dataset as an html table.{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[Boolean]} escape_values -- if true, replaces illegal HTML characters with corresponding valid escape sequences.
\{[Boolean]} escape_spaces -- if true, replaces text spaces with non\-breaking space tags ( ) and tabs by four non\-breaking space tags.
\{[Boolean]} multi_line_markup -- if true, multiLineMarkup will enforce new lines that are in the text; single new lines will be replaced by <br>, multiple new lines will be replaced by <p>
\{[Boolean]} pretty_indent -- if true, adds indentation for more readable HTML code.
\{[Boolean]} add_column_names -- if false, column headers will not be added to the table.
{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[String] -- String html.{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
//gets a dataset based on a query
//useful to limit the number of rows
var maxReturnedRows = 10;
var query = 'select c1,c2,c3 from test_table where start_date = ?';

//to access data by name, do not use '.' or special characters in names or aliases
var args = new Array();
args[0] = order_date //or new Date();
var dataset = databaseManager.getDataSetByQuery(databaseManager.getDataSourceServerName(controller.getDataSource()),query,args,maxReturnedRows);

// gets a dataset with escape values; escape spaces (lines will not wrap); no multi-line markup; with pretty indentation; shows column names
var htmlTable = dataset.getAsHTML(true, true, false, true, true);

//assigns the dataset to a field and sets the display type to HTML_AREA
//assuming the html_field is a global text variable
scopes.globals.html_field = '<html>'+dataset.getAsHTML()+'</html>';

//Note: To display an HTML_AREA field as an HTML page, add HTML tags at the beginning '<html>' and at the end '</html>'.
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=getAsText-String_String_String_Boolean}{tr:id=name}{td}h6.getAsText{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[String]{span}{span:style=font-weight: bold;}getAsText{span}{span}\(column_separator, row_separator, value_delimiter, add_column_names){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Get the dataset as formatted text.{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[String]} column_separator -- any specified column separator; examples: tab '\t'; comma ','; semicolon ';'; space ' ' .
\{[String]} row_separator -- the specified row separator; examples: new line '\n'.
\{[String]} value_delimiter -- the specified value delimiter; example: double quote '"'.
\{[Boolean]} add_column_names -- if true column names will be added as a first row.
{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[String] -- String formatted text.{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
//assuming the variable dataset contains a dataset
//you can create csv or tab delimited results
var csv = dataset.getAsText(',','\n','"',true)
var tab = dataset.getAsText('\t','\n','"',true)
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=getColumnAsArray-Number}{tr:id=name}{td}h6.getColumnAsArray{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[Object]\[]{span}{span:style=font-weight: bold;}getColumnAsArray{span}{span}\(index){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Get the column data of a dataset as an Array.{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[Number]} index -- index of column (1\-based).
{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Object]\[] -- Object array of data.{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
//assuming the variable dataset contains a dataset
var dataArray = dataset.getColumnAsArray(1); //puts the contents from the first column of the dataset into an array
//once you have it as an array you can loop through it or feed it to a custom valuelist for example
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=getColumnName-Number}{tr:id=name}{td}h6.getColumnName{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[String]{span}{span:style=font-weight: bold;}getColumnName{span}{span}\(index){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Get a column name based on index.{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[Number]} index -- index of column (1\-based).
{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[String] -- String column name.{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
//assuming the variable dataset contains a dataset
var firstColumName = dataset.getColumnName(1) //retrieves the first columnname into the variable firstColumName
//using a loop you can get all columnames in an array:
var query = 'select * from customers';
var dataset = databaseManager.getDataSetByQuery(databaseManager.getDataSourceServerName(controller.getDataSource()), query, null, 100);
var colArray = new Array()
for (var i = 1; i <= dataset.getMaxColumnIndex(); i++)
{
	colArray[i-1] = dataset.getColumnName(i)
	//note the -1, because an array is zero based and dataset is 1 based.
}
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=getColumnType-Number}{tr:id=name}{td}h6.getColumnType{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[Number]{span}{span:style=font-weight: bold;}getColumnType{span}{span}\(index){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Get a column type based on index.{div}{td}{tr}{tr:id=snc}{td}*Since*\\{div:class=sIndent}6.1.4{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[Number]} index -- index of column (1\-based).
{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Number] -- Number the column type (JSColumn constant){div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
//assuming the variable dataset contains a dataset
var firstColumnType = dataset.getColumnType(1) //retrieves the first column's type into the variable firstColumnType
if (firstColumnType == JSColumn.NUMBER) { }
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=getException}{tr:id=name}{td}h6.getException{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[ServoyException]{span}{span:style=font-weight: bold;}getException{span}{span}\(){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Get the database exception if an error occurred.{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[ServoyException] -- ServoyException exception or null when not available.{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
//assuming the variable dataset contains a dataset
var dbException = dataset.getException();
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=getMaxColumnIndex}{tr:id=name}{td}h6.getMaxColumnIndex{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[Number]{span}{span:style=font-weight: bold;}getMaxColumnIndex{span}{span}\(){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Get the number of columns in the dataset.{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Number] -- int number of columns.{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
//assuming the variable dataset contains a dataset
for (var i = 1; i <= dataset.getMaxColumnIndex(); i++)
{
	colArray[i-1] = dataset.getColumnName(i)
	//have to subtract 1, because an array is zero based and a dataset is 1 based.
}
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=getMaxRowIndex}{tr:id=name}{td}h6.getMaxRowIndex{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[Number]{span}{span:style=font-weight: bold;}getMaxRowIndex{span}{span}\(){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Get the number of rows in the dataset.{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Number] -- int number of rows.{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
//assuming the variable dataset contains a dataset
var totalRows = dataset.getMaxRowIndex();
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=getRowAsArray-Number}{tr:id=name}{td}h6.getRowAsArray{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[Object]\[]{span}{span:style=font-weight: bold;}getRowAsArray{span}{span}\(index){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Get the row data of a dataset as an Array.{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[Number]} index -- index of row (1\-based).
{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Object]\[] -- Object array of data.{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
//assuming the variable dataset contains a dataset
var dataArray = dataset.getRowAsArray(1); //puts the contents from the first row of the dataset into an array
//once you have it as an array you can loop through it
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=getValue-Number_Number}{tr:id=name}{td}h6.getValue{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[Object]{span}{span:style=font-weight: bold;}getValue{span}{span}\(row, col){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Get the value specified by row and column position from the dataset.{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[Number]} row -- row number, 1\-based
\{[Number]} col -- column number, 1\-based
{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Object] -- Object value{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
//assuming the variable dataset contains a dataset
var dataAtRow2Col1 = dataset.getValue(2, 1);
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=hadMoreData}{tr:id=name}{td}h6.hadMoreData{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[Boolean]{span}{span:style=font-weight: bold;}hadMoreData{span}{span}\(){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Return true if there is more data in the resultset then specified by maxReturnedRows at query time.{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Boolean] -- boolean more data available{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
var ds = databaseManager.getDataSetByQuery('example_data', 'select order_id from orders', null, 10000)
if (ds.hadMoreData())
{
	// handle large result
}
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=removeColumn-Number}{tr:id=name}{td}h6.removeColumn{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[Boolean]{span}{span:style=font-weight: bold;}removeColumn{span}{span}\(index){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Remove a column by index from the dataset.{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[Number]} index -- index of column to remove (1\-based)
{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Boolean] -- true if succeeded, else false.{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
//assuming the variable dataset contains a dataset
var success = dataset.removeColumn(1); // removes first column
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=removeRow-Number}{tr:id=name}{td}h6.removeRow{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}void{span}{span:style=font-weight: bold;}removeRow{span}{span}\(row){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Remove a row from the dataset.{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[Number]} row -- row index to remove, \-1 for all rows
{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}void{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
//assuming the variable dataset contains a dataset
dataset.removeRow(1); //removes the first row
dataset.removeRow(-1); //removes all rows
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=setColumnName-Number_String}{tr:id=name}{td}h6.setColumnName{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}void{span}{span:style=font-weight: bold;}setColumnName{span}{span}\(index, columnName){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Set a column name based on index.{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[Number]} index -- index of column (1\-based).
\{[String]} columnName -- new column name.
{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}void{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
var query = 'select customerid, customername from customers';
var dataset = databaseManager.getDataSetByQuery(databaseManager.getDataSourceServerName(controller.getDataSource()), query, null, -1);
dataset.setColumnName(2, 'name_of_customer') // change the column name for second column.
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=setValue-Number_Number_Object}{tr:id=name}{td}h6.setValue{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}void{span}{span:style=font-weight: bold;}setValue{span}{span}\(row, col, obj){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Set the value specified by row and column position from the dataset.
Use row = \-1, to set columnnames.{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[Number]} row -- row number, 1\-based
\{[Number]} col -- column number, 1\-based
\{[Object]} obj -- the value to be stored at the given row and column.
{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}void{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
//assuming the variable dataset contains a dataset
dataset.getValue(2, 1,'data');
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=sort-Number_Boolean}{tr:id=name}{td}h6.sort{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}void{span}{span:style=font-weight: bold;}sort{span}{span}\(col, sort_direction){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Sort the dataset on the given column (1\-based) in ascending or descending.{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[Number]} col -- column number, 1\-based
\{[Boolean]} sort_direction -- ascending (true) or descending (false)
{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}void{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
// sort using column number
//assuming the variable dataset contains a dataset
dataset.sort(1, false)
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=sort-Function}{tr:id=name}{td}h6.sort{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}void{span}{span:style=font-weight: bold;}sort{span}{span}\(comparator){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Sort the dataset using the function as comparator.
The comparator function is called to compare two rows, that are passed as arguments, and
it will return \-1/0/1 if the first row is less/equal/greater then the second row.

NOTE: starting with 7.2 release, when called on datasource(foundset) dataset, this function doesn't save the data anymore{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[Function]} comparator -- comparator function
{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}void{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript}
//sort using comparator
dataset.sort(mySortFunction);

function mySortFunction(r1, r2)
{
	var o = 0;
	if(r1[0] < r2[0])
	{
		o = -1;
	}
	else if(r1[0] > r2[0])
	{
		o = 1;
	}
	return o;
}
{code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{table}