Table Row (tr) |
---|
| Table Head (th) |
---|
| Method Details |
|
Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
Span |
---|
style | float: left; margin-right: 5px; |
---|
| Boolean |
Span |
---|
style | float: left; font-weight: bold; |
---|
id | iets |
---|
| addColumn |
Span |
---|
| (name, [index], [type]) |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
adds a column with the specified name to the dataset. |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters name – column name. [index] – column index number between 1 and getMaxColumnIndex(). [type] – the type of column, see JSColumn constants. |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Returns Boolean – true if succeeded, else false. |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
//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|class=node}{tr:id=name}{td}h6.addHTMLProperty{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}void{span}{span:id=iets|style=float: left; font-weight: bold;}addHTMLProperty{span}{span:id=iets|style=float: left;}\(row, col, name, value){span}{td}{tr}{tr:id=des}{td}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{td}{tr}{tr:id=prs}{td}*Parameters*\\ \{[Number]} row -- row number
\{[Number]} col -- column number
\{[String]} name -- String property name
\{[String]} value -- String property value
{td}{tr}{tr:id=ret}{td}*Returns*\\void{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} Table Body (tbody) |
---|
id | addHTMLProperty |
---|
class | node |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
addHTMLProperty |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Span |
---|
style | float: left; margin-right: 5px; |
---|
| void |
Span |
---|
style | float: left; font-weight: bold; |
---|
id | iets |
---|
| addHTMLProperty |
Span |
---|
| (row, col, name, value) |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
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 |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters {Number} row – row number {Number} col – column number {String} name – String property name {String} value – String property value |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Returns void |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
//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');
globals.html_field = '<html>'+dataset.getAsHTML()+'</html>';
|
|
|
|
| {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=|=}{:=}{td}h6.addRow{td}{tr}{tr:id=sig}{td}{span:style=float: left; Table Row (tr) |
---|
| Table Cell (td) |
---|
Span |
---|
style | float: left; margin-right: |
---|
|
|
|
| }{span}{span:id=iets|style= font-weight: bold;}addRow{span}{span:id=iets|style=float: left;}\(index, array){span}{td}{tr}{tr:id=des}{td}Add a row to the dataset.{td}{tr}{tr:id=prs}{td}*Parameters*\\ \{[Number]} index -- index to add row (1\-based)
\{[Object]\[]} array -- row data
{td}{tr}{tr:id=ret}{td}*Returns*\\void{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} Table Row (tr) |
---|
| Table Cell (td) |
---|
Add a row to the dataset. |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters {Number} index – index to add row (1-based) {Object[]} array – row data |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Returns void |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
//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 after row 2
|
|
|
|
| {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=addRow-|class=node}{tr:id=name}{td}h6.addRow{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}void{span}{span:id=iets|style=float: left; font-weight: bold;}addRow{span}{span:id=iets|style=float: left;}\(array){span}{td}{tr}{tr:id=des}{td}Add a row to the dataset. The row will be added as the last row.{td}{tr}{tr:id=prs}{td}*Parameters*\\ \{[Object]\[]} array -- row data
{td}{tr}{tr:id=ret}{td}*Returns*\\void{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
Span |
---|
style | float: left; margin-right: 5px; |
---|
| void |
Span |
---|
style | float: left; font-weight: bold; |
---|
id | iets |
---|
| addRow |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Add a row to the dataset. The row will be added as the last row. |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters {Object[]} array – row data |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Returns void |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
//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 after row 2
|
|
|
|
| {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=createDataSource-String|class=node}{tr:id=name}{td}h6.createDataSource{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[String]{span}{span:id=iets|style=float: left; font-weight: bold;}createDataSource{span}{span:id=iets|style=float: left;}\(name){span}{td}{tr}{tr:id=des}{td}Create a data source from the data set with specified name and using specified types.
The types are inferred from the data if possible.{td}{tr}{tr:id=prs}{td}*Parameters*\\ \{[String]} name -- data source name
{td}{tr}{tr:id=ret}{td}*Returns*\\ [String] -- String uri reference to the created data source.{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} Table Body (tbody) |
---|
id | createDataSource-String |
---|
class | node |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
createDataSource |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Span |
---|
style | float: left; margin-right: 5px; |
---|
| String |
Span |
---|
style | float: left; font-weight: bold; |
---|
id | iets |
---|
| createDataSource |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Create a data source from the data set with specified name and using specified types. The types are inferred from the data if possible. |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters {String} name – data source name |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Returns String – String uri reference to the created data source. |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
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= Table Body (tbody) |
---|
id | createDataSource-String_Object |
---|
| |=}{:=}{td}h6.createDataSource{td}{tr}{tr:id=sig}{td}{span:style=float: left; | Table Cell (td) |
---|
createDataSource |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Span |
---|
style | float: left; margin-right: |
---|
|
|
|
| }[]{span}{span:id=iets|style= }createDataSource{span}{span:id=iets|style=float: left;}\(name, types){span}{td}{tr}{tr:id=des}{td}Create a data source from the data set with specified name and using specified types.{td}{tr}{tr:id=prs}{td}*Parameters*\\ \{[String]} name -- data source name
\{[Object]} types -- array of types as defined in JSColumn
{td}{tr}{tr:id=ret}{td}*Returns*\\ [String] -- String uri reference to the created data source.{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} Table Row (tr) |
---|
| Table Cell (td) |
---|
Create a data source from the data set with specified name and using specified types. |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters {String} name – data source name {Object} types – array of types as defined in JSColumn |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Returns String – String uri reference to the created data source. |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
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|class=node}{tr:id=name}{td}h6.getAsHTML{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[String]{span}{span:id=iets|style=float: left; font-weight: bold;}getAsHTML{span}{span:id=iets|style=float: left;}\(\[escape_values\], \[escape_spaces\], \ Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
Span |
---|
style | float: left; margin-right: 5px; |
---|
| String |
Span |
---|
style | float: left; font-weight: bold; |
---|
id | iets |
---|
| getAsHTML |
Span |
---|
| ([escape_values], [escape_spaces], [multi_line_markup |
|
|
| \ \\ \\{span}{td}{tr}{tr:id=des}{td}Get the dataset as an html table.{td}{tr}{tr:id=prs}{td}*Parameters*\\ \[escape\_values\] -- if true, replaces illegal HTML characters with corresponding valid escape sequences.
\[escape\_spaces\] -- if true, replaces text spaces with non\-breaking space tags ( ) and tabs by four non\-breaking space tags.
\[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>
\[pretty\_indent\] -- if true, adds indentation for more readable HTML code.
\[add\_column\_names\] -- if false, column headers will not be added to the table.
{td}{tr}{tr:id=ret}{td}*Returns*\\ [String] -- String html.{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} Table Row (tr) |
---|
| Table Cell (td) |
---|
Get the dataset as an html table. |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters [escape_values] – if true, replaces illegal HTML characters with corresponding valid escape sequences. [escape_spaces] – if true, replaces text spaces with non-breaking space tags ( ) and tabs by four non-breaking space tags. [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> [pretty_indent] – if true, adds indentation for more readable HTML code. [add_column_names] – if false, column headers will not be added to the table. |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Returns String – String html. |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
//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
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|class=node}{tr:id=name}{td}h6.getAsText{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[String]{span}{span:id=iets|style=float: left; font-weight: bold;}getAsText{span}{span:id=iets|style=float: left;}\(column_separator, row_separator, value_delimiter, add_column_names){span}{td}{tr}{tr:id=des}{td}Get the dataset as formatted text.{td}{tr}{tr:id=prs}{td}*Parameters*\\ \{[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.
{td}{tr}{tr:id=ret}{td}*Returns*\\ [String] -- String formatted text.{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
Span |
---|
style | float: left; margin-right: 5px; |
---|
| String |
Span |
---|
style | float: left; font-weight: bold; |
---|
id | iets |
---|
| getAsText |
Span |
---|
| (column_separator, row_separator, value_delimiter, add_column_names) |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Get the dataset as formatted text. |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters {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. |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Returns String – String formatted text. |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
//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|class=node}{tr:id=name}{td}h6.getColumnAsArray{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[Object]\[]{span}{span:id=iets|style=float: left; font-weight: bold;}getColumnAsArray{span}{span:id=iets|style=float: left;}\(index){span}{td}{tr}{tr:id=des}{td}Get the column data of a dataset as an Array.{td}{tr}{tr:id=prs}{td}*Parameters*\\ \{[Number]} index -- index of column (1\-based).
{td}{tr}{tr:id=ret}{td}*Returns*\\ [Object]\[] -- Object array of data.{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} Table Body (tbody) |
---|
id | getColumnAsArray |
---|
class | node |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
getColumnAsArray |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Span |
---|
style | float: left; margin-right: 5px; |
---|
| Object[] |
Span |
---|
style | float: left; font-weight: bold; |
---|
id | iets |
---|
| getColumnAsArray |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Get the column data of a dataset as an Array. |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters {Number} index – index of column (1-based). |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Returns Object[] – Object array of data. |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
//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|class=node}{tr:id=name}{td}h6.getColumnName{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[String]{span}{span:id=iets|style=float: left; font-weight: bold;}getColumnName{span}{span:id=iets|style=float: left;}\(index){span}{td}{tr}{tr:id=des}{td}Get a column name based on index.{td}{tr}{tr:id=prs}{td}*Parameters*\\ \{[Number]} index -- index of column (1\-based).
{td}{tr}{tr:id=ret}{td}*Returns*\\ [String] -- String column name.{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
getColumnName |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Span |
---|
style | float: left; margin-right: 5px; |
---|
| String |
Span |
---|
style | float: left; font-weight: bold; |
---|
id | iets |
---|
| getColumnName |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Get a column name based on index. |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters {Number} index – index of column (1-based). |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Returns String – String column name. |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
//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=getException|class=node}{tr:id=name}{td}h6.getException{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[ServoyException]{span}{span:id=iets|style=float: left; font-weight: bold;}getException{span}{span:id=iets|style=float: left;}\(){span}{td}{tr}{tr:id=des}{td}Get the database exception if an error occurred.{td}{tr}{tr:id=ret}{td}*Returns*\\ [ServoyException] -- ServoyException exception or null when not available.{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
getException |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Span |
---|
style | float: left; font-weight: bold; |
---|
id | iets |
---|
| getException |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Get the database exception if an error occurred. |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Returns ServoyException – ServoyException exception or null when not available. |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
//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|class=node}{tr:id=name}{td}h6.getMaxColumnIndex{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[Number]{span}{span:id=iets|style=float: left; font-weight: bold;}getMaxColumnIndex{span}{span:id=iets|style=float: left;}\(){span}{td}{tr}{tr:id=des}{td}Get the number of columns in the dataset.{td}{tr}{tr:id=ret}{td}*Returns*\\ [Number] -- int number of columns.{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} Table Body (tbody) |
---|
id | getMaxColumnIndex |
---|
class | node |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
getMaxColumnIndex |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Span |
---|
style | float: left; margin-right: 5px; |
---|
| Number |
Span |
---|
style | float: left; font-weight: bold; |
---|
id | iets |
---|
| getMaxColumnIndex |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Get the number of columns in the dataset. |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Returns Number – int number of columns. |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
//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|class=node}{tr:id=name}{td}h6.getMaxRowIndex{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[Number]{span}{span:id=iets|style=float: left; font-weight: bold;}getMaxRowIndex{span}{span:id=iets|style=float: left;}\(){span}{td}{tr}{tr:id=des}{td}Get the number of rows in the dataset.{td}{tr}{tr:id=ret}{td}*Returns*\\ [Number] -- int number of rows.{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} Table Body (tbody) |
---|
id | getMaxRowIndex |
---|
class | node |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
getMaxRowIndex |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Span |
---|
style | float: left; margin-right: 5px; |
---|
| Number |
Span |
---|
style | float: left; font-weight: bold; |
---|
id | iets |
---|
| getMaxRowIndex |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Get the number of rows in the dataset. |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Returns Number – int number of rows. |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
//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|class=node}{tr:id=name}{td}h6.getRowAsArray{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[Object]\[]{span}{span:id=iets|style=float: left; font-weight: bold;}getRowAsArray{span}{span:id=iets|style=float: left;}\(index){span}{td}{tr}{tr:id=des}{td}Get the row data of a dataset as an Array.{td}{tr}{tr:id=prs}{td}*Parameters*\\ \{[Number]} index -- index of row (1\-based).
{td}{tr}{tr:id=ret}{td}*Returns*\\ [Object]\[] -- Object array of data.{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
getRowAsArray |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Span |
---|
style | float: left; margin-right: 5px; |
---|
| Object[] |
Span |
---|
style | float: left; font-weight: bold; |
---|
id | iets |
---|
| getRowAsArray |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Get the row data of a dataset as an Array. |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters {Number} index – index of row (1-based). |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Returns Object[] – Object array of data. |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
//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|class=node}{tr:id=name}{td}h6.getValue{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[Object]{span}{span:id=iets|style=float: left; font-weight: bold;}getValue{span}{span:id=iets|style=float: left;}\(row, col){span}{td}{tr}{tr:id=des}{td}Get the value specified by row and column position from the dataset.{td}{tr}{tr:id=prs}{td}*Parameters*\\ \{[Number]} row -- row number, 1\-based
\{[Number]} col -- column number, 1\-based
{td}{tr}{tr:id=ret}{td}*Returns*\\ [Object] -- Object value{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
Span |
---|
style | float: left; margin-right: 5px; |
---|
| Object |
Span |
---|
style | float: left; font-weight: bold; |
---|
id | iets |
---|
| getValue |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Get the value specified by row and column position from the dataset. |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters {Number} row – row number, 1-based {Number} col – column number, 1-based |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Returns Object – Object value |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
//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|class=node}{tr:id=name}{td}h6.hadMoreData{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[Boolean]{span}{span:id=iets|style=float: left; font-weight: bold;}hadMoreData{span}{span:id=iets|style=float: left;}\(){span}{td}{tr}{tr:id=des}{td}Return true if there is more data in the resultset then specified by maxReturnedRows at query time.{td}{tr}{tr:id=ret}{td}*Returns*\\ [Boolean] -- boolean more data available{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
hadMoreData |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Span |
---|
style | float: left; margin-right: 5px; |
---|
| Boolean |
Span |
---|
style | float: left; font-weight: bold; |
---|
id | iets |
---|
| hadMoreData |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Return true if there is more data in the resultset then specified by maxReturnedRows at query time. |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Returns Boolean – boolean more data available |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
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|class=node}{tr:id=name}{td}h6.removeColumn{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[Boolean]{span}{span:id=iets|style=float: left; font-weight: bold;}removeColumn{span}{span:id=iets|style=float: left;}\(index){span}{td}{tr}{tr:id=des}{td}Remove a column by index from the dataset.{td}{tr}{tr:id=prs}{td}*Parameters*\\ \{[Number]} index -- index of column to remove (1\-based)
{td}{tr}{tr:id=ret}{td}*Returns*\\ [Boolean] -- true if succeeded, else false.{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
removeColumn |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Span |
---|
style | float: left; margin-right: 5px; |
---|
| Boolean |
Span |
---|
style | float: left; font-weight: bold; |
---|
id | iets |
---|
| removeColumn |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Remove a column by index from the dataset. |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters {Number} index – index of column to remove (1-based) |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Returns Boolean – true if succeeded, else false. |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
//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|class=node}{tr:id=name}{td}h6.removeRow{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}void{span}{span:id=iets|style=float: left; font-weight: bold;}removeRow{span}{span:id=iets|style=float: left;}\(row){span}{td}{tr}{tr:id=des}{td}Remove a row from the dataset.{td}{tr}{tr:id=prs}{td}*Parameters*\\ \{[Number]} row -- row index to remove, \-1 for all rows
{td}{tr}{tr:id=ret}{td}*Returns*\\void{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
Span |
---|
style | float: left; margin-right: 5px; |
---|
| void |
Span |
---|
style | float: left; font-weight: bold; |
---|
id | iets |
---|
| removeRow |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Remove a row from the dataset. |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters {Number} row – row index to remove, -1 for all rows |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Returns void |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
//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=setValue|class=node}{tr:id=name}{td}h6.setValue{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}void{span}{span:id=iets|style=float: left; font-weight: bold;}setValue{span}{span:id=iets|style=float: left;}\(row, col, obj){span}{td}{tr}{tr:id=des}{td}Set the value specified by row and column position from the dataset.
Use row = \-1, to set columnnames.{td}{tr}{tr:id=prs}{td}*Parameters*\\ \{[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.
{td}{tr}{tr:id=ret}{td}*Returns*\\void{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
Span |
---|
style | float: left; margin-right: 5px; |
---|
| void |
Span |
---|
style | float: left; font-weight: bold; |
---|
id | iets |
---|
| setValue |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Set the value specified by row and column position from the dataset. Use row = -1, to set columnnames. |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters {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. |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Returns void |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
//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=|=}{:=}{td}h6.sort{td}{tr}{tr:id=sig}{td}{span:style=float: left; Table Row (tr) |
---|
| Table Cell (td) |
---|
Span |
---|
style | float: left; margin-right: |
---|
|
|
|
| }{span}{span:id=iets|style= : bold;}sort{span}{span:id=iets|style=float: left;}\(col, sort_direction){span}{td}{tr}{tr:id=des}{td}Sort the dataset on the given column in ascending or descending.{td}{tr}{tr:id=prs}{td}*Parameters*\\ \{[Number]} col -- column number, 1\-based
\{[Boolean]} sort_direction -- true for ascending, false for descending
{td}{tr}{tr:id=ret}{td}*Returns*\\void{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} Span |
---|
| (col, sort_direction) |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sort the dataset on the given column in ascending or descending. |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters {Number} col – column number, 1-based {Boolean} sort_direction – true for ascending, false for descending |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Returns void |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
//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|class=node}{tr:id=name}{td}h6.sort{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}void{span}{span:id=iets|style=float: left; font-weight: bold;}sort{span}{span:id=iets|style=float: left;}\(rowComparator){span}{td}{tr}{tr:id=des}{td}Sort the dataset using a comparator function.
The comparator function is called to compare
two rows, that are passed as arguments, and
it will return \ Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
Span |
---|
style | float: left; margin-right: 5px; |
---|
| void |
Span |
---|
style | float: left; font-weight: bold; |
---|
id | iets |
---|
| sort |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sort the dataset using a comparator function. The comparator function is called to compare two rows, that are passed as arguments, and it will return -1/0/1 |
|
|
{td}{tr}{tr:id=prs}{td}*Parameters*\\ \{[Function]} rowComparator -- the function used to compare two rows
{td}{tr}{tr:id=ret}{td}*Returns*\\void{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters {Function} rowComparator – the function used to compare two rows |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Returns void |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
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} |