Child pages
  • JSTableObject

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin
Hidden
DO NOT EDIT THE CONTENT OF THIS PAGE DIRECTLY, UNLESS YOU KNOW WHAT YOU'RE DOING.
		THE STRUCTURE OF THE CONTENT IS VITAL IN BEING ABLE TO EXTRACT CHANGES FROM THE PAGE AND MERGE THEM BACK INTO SERVOY SOURCE


HTML Table
classservoy sSummary
Colgroup Tag
Column
padding0px
width80px

Column

Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan2
Method Summary
Table Body (tbody)
Table Row (tr)
Table Cell (td)
JSColumn
Table Cell (td)
#createNewColumn(columnName, type, length, allowNull, pkColumn)
Creates a new column in this table.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
void
Table Cell (td)
#deleteColumn(columnName)
Deletes the column with the specified name from this table.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
JSColumn
Table Cell (td)
#getColumn(name)
Returns a JSColumn for the named column.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
String[]
Table Cell (td)
#getColumnNames()
Returns an array containing the names of all table columns.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
String
Table Cell (td)
#getDataSource()
Returns the table data source uri.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
String
Table Cell (td)
#getQuotedSQLName()
Returns a quoted version of the table name, if necessary, as defined by the actual database used.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
String[]
Table Cell (td)
#getRowIdentifierColumnNames()
Returns an array containing the names of the identifier (PK) column(s).
Table Body (tbody)
Table Row (tr)
Table Cell (td)
String
Table Cell (td)
#getSQLName()
Returns the table name.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
String
Table Cell (td)
#getServerName()
Returns the Servoy server name.

HTML Table
idfunction
classservoy sDetail
Colgroup Tag
Column
padding0px
width100%

Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan1
Method Details
Table Body (tbody)
idcreateNewColumn
classnode
Table Row (tr)
idname
Table Cell (td)
createNewColumn
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
JSColumn
Span
stylefloat: left; font-weight: bold;
idiets
createNewColumn
Span
stylefloat: left;
idiets
(columnName, type, length, allowNull, pkColumn)
Table Row (tr)
iddes
Table Cell (td)
Creates a new column in this table. The name, type and length of the new column must be specified. For specifying the
type of the column, use the JSColumn constants. The column is not actually created in the database until this
table is synchronized with the database using the JSServer.synchronizeWithDB method. The "allowNull" optional argument specifies if the
column accepts null values (by default it does). The "pkColumn" optional argument specifies if the column is a primary key column (by default it is not).
The method returns a JSColumn instance that corresponds to the newly created column. If any error occurs and the column cannot be created, then the method
returns null.
Table Row (tr)
idprs
Table Cell (td)
Parameters
columnName
type
length
allowNull
pkColumn
Table Row (tr)
idret
Table Cell (td)
Returns
JSColumn
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var server = plugins.maintenance.getServer("example_data");
if (server)
{
	var table = server.createNewTable("users");
	if (table)
	{
		table.createNewColumn("id", JSColumn.INTEGER, 0, false, true);
		table.createNewColumn("name", JSColumn.TEXT, 100);
		table.createNewColumn("age", JSColumn.INTEGER, 0);
		table.createNewColumn("last_login", JSColumn.DATETIME, 0);
		var result = server.synchronizeWithDB(table);
		if (result) application.output("Table successfully created.");
		else application.output("Table not created.");
	}
}
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
iddeleteColumn
classnode
Table Row (tr)
idname
Table Cell (td)
deleteColumn
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
void
Span
stylefloat: left; font-weight: bold;
idiets
deleteColumn
Span
stylefloat: left;
idiets
(columnName)
Table Row (tr)
iddes
Table Cell (td)
Deletes the column with the specified name from this table. The column is not actually deleted from the database until this
table is synchronized with the database using the JSServer.synchronizeWithDB method.
Table Row (tr)
idprs
Table Cell (td)
Parameters
{String} columnName
Table Row (tr)
idret
Table Cell (td)
Returns
void
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var server = plugins.maintenance.getServer("example_data");
if (server) {
	var table = server.getTable("users");
	if (table) {
		table.deleteColumn("last_login");
		server.synchronizeWithDB(table);
	}
}
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idgetColumn
classnode
Table Row (tr)
idname
Table Cell (td)
getColumn
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
JSColumn
Span
stylefloat: left; font-weight: bold;
idiets
getColumn
Span
stylefloat: left;
idiets
(name)
Table Row (tr)
iddes
Table Cell (td)
Returns a JSColumn for the named column.
Table Row (tr)
idprs
Table Cell (td)
Parameters
{String} name – The name of the column to return the value from.
Table Row (tr)
idret
Table Cell (td)
Returns
JSColumn – JSColumn column.
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var jsTable = databaseManager.getTable('udm', 'campaigns')
var jsColumn = jsTable.getColumn('campaign_name')
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idgetColumnNames
classnode
Table Row (tr)
idname
Table Cell (td)
getColumnNames
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
String[]
Span
stylefloat: left; font-weight: bold;
idiets
getColumnNames
Span
stylefloat: left;
idiets
()
Table Row (tr)
iddes
Table Cell (td)
Returns an array containing the names of all table columns.
Table Row (tr)
idret
Table Cell (td)
Returns
String[] – String array of column names.
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var jsTable = databaseManager.getTable('udm', 'campaigns')
var columnNames = jsTable.getColumnNames()
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idgetDataSource
classnode
Table Row (tr)
idname
Table Cell (td)
getDataSource
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
String
Span
stylefloat: left; font-weight: bold;
idiets
getDataSource
Span
stylefloat: left;
idiets
()
Table Row (tr)
iddes
Table Cell (td)
Returns the table data source uri.
Table Row (tr)
idret
Table Cell (td)
Returns
String – String datasource uri.
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var jsTable = databaseManager.getTable('udm', 'campaigns')
var dataSource = jsTable.getDataSource()
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idgetQuotedSQLName
classnode
Table Row (tr)
idname
Table Cell (td)
getQuotedSQLName
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
String
Span
stylefloat: left; font-weight: bold;
idiets
getQuotedSQLName
Span
stylefloat: left;
idiets
()
Table Row (tr)
iddes
Table Cell (td)
Returns a quoted version of the table name, if necessary, as defined by the actual database used.
Table Row (tr)
idret
Table Cell (td)
Returns
String – String table name, quoted if needed.
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
//use with the raw SQL plugin:
//if the table name contains characters that are illegal in sql, the table name will be quoted
var jsTable = databaseManager.getTable('udm', 'campaigns')
var quotedTableName = jsTable.getQuotedSQLName()
plugins.rawSQL.executeSQL('udm',  quotedTableName,  'select * from ' + quotedTableName + ' where is_active = ?', [1])
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idgetRowIdentifierColumnNames
classnode
Table Row (tr)
idname
Table Cell (td)
getRowIdentifierColumnNames
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
String[]
Span
stylefloat: left; font-weight: bold;
idiets
getRowIdentifierColumnNames
Span
stylefloat: left;
idiets
()
Table Row (tr)
iddes
Table Cell (td)
Returns an array containing the names of the identifier (PK) column(s).
Table Row (tr)
idret
Table Cell (td)
Returns
String[] – String array of row identifier column names.
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var jsTable = databaseManager.getTable('udm', 'campaigns')
var identifierColumnNames = jsTable.getRowIdentifierColumnNames()
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idgetSQLName
classnode
Table Row (tr)
idname
Table Cell (td)
getSQLName
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
String
Span
stylefloat: left; font-weight: bold;
idiets
getSQLName
Span
stylefloat: left;
idiets
()
Table Row (tr)
iddes
Table Cell (td)
Returns the table name.
Table Row (tr)
idret
Table Cell (td)
Returns
String – String table name.
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var jsTable = databaseManager.getTable('udm', 'campaigns')
var tableNameForDisplay = jsTable.getSQLName()
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idgetServerName
classnode
Table Row (tr)
idname
Table Cell (td)
getServerName
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
String
Span
stylefloat: left; font-weight: bold;
idiets
getServerName
Span
stylefloat: left;
idiets
()
Table Row (tr)
iddes
Table Cell (td)
Returns the Servoy server name.
Table Row (tr)
idret
Table Cell (td)
Returns
String – String server name.
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var jsTable = databaseManager.getTable('udm', 'campaigns')
var serverName = jsTable.getServerName()
Table Row (tr)
classlastDetailRow
Table Cell (td)