Child pages
  • JSTableObject

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Divcache
Div
iddescription
HTML Table
id
classservoy sSummary
Colgroup Tag
Col
width80px
Col
Table Head (thead)
Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan2
Method Summary
Table Row (tr)
Table Cell (td)
JSColumnObject
Table Cell (td)createNewColumn(columnName, type, length)
styleindexdisplay: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.

true
refresh100d
showRefreshtrue
iddoc
titleRefresh page
showDatetrue
retryEnable
id

servoy sReturnTypes2100%height: 30px;2Supported ClientssWordListSmartClientsWordListWebClientsWordListNGClient

Table Cell (td)
JSColumnObject
Table Cell (td)createNewColumn(columnName, type, length, allowNull)
servoy sSummary12%30%58%height: 30px;3Methods SummaryCreates a new column in this table. Table Row (tr)Creates a new column in this table. Table Row (tr)
Table Cell (td)
JSColumnObject
Table Cell (td)createNewColumn(columnName, type, length, allowNull, pkColumn)
Table Cell (td)Creates a new column in this table. Table Row (tr) Table Cell (td)deleteColumn(columnName)
voidgetColumn(name)
Deletes the column with the specified name from this table. Table Row (tr)
Table Cell (td)
JSColumn
Table Cell (td)Returns a JSColumn for the named column (or column dataproviderID). Table Row (tr)
Table Cell (td)
String[]
Table Cell (td)getColumnNames()
Returns an array containing the names of all table columns. Table Row (tr)
Table Cell (td)
String
Table Cell (td)getDataSource()
Returns the table data source uri. 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 Row (tr)
Table Cell (td)
String[]
Table Cell (td)getRowIdentifierColumnNames()
Table Row (tr)
Table Cell (td)
String
Table Cell (td)getSQLName()
Returns an array containing the names of the identifier (PK) column(s).
Table Cell (td)
String
Table Cell (td)getServerName()
Returns the table name. Table Row (tr) Table Cell (td)isMetadataTable()
Returns the Servoy server name. Table Row (tr)
Table Cell (td)
Boolean
Returns whether table was flagged as metadata table. HTML Table

functionclass Colgroup Tag Colcolspanservoy sDetail2width100%

Col
Table Head (thead) Table Row (tr)styleheight:30px;
Table Head (th)
colspan2
Method Details
Table Body (tbody)
idcreateNewColumn-String_Number_Number
Table Row (tr)
idname
Table Cell (td)

createNewColumn

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
JSColumnObject
Span
stylefont-weight: bold;
createNewColumn
Spanid2Methods DetailscreateNewColumnname

createNewColumn(columnName, type, length)

Table Row (tr)des Table Cell (td) DivclasssIndentCreates 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 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
Table Row (tr)id returns null.tdprs

Parameters

Divclass Table Body (tbody)
idcreateNewColumn-String_Number_Number_Boolean
Table Row (tr)
idname
Table Cell (td)

createNewColumn

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
JSColumnObject
Span
stylefont-weight: bold;
createNewColumn
Span

sIndent{String} columnName
{Number} type
{Number} length

Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
JSColumnObject
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)
	{
		var pk = table.createNewColumn("id", JSColumn.MEDIA, 16); // can also use (JSColumn.TEXT, 36) for UUIDs
		pk.rowIdentifierType = JSColumn.PK_COLUMN;
		pk.setFlag(JSColumn.UUID_COLUMN, true)
		pk.sequenceType = JSColumn.UUID_GENERATOR
		var c = table.createNewColumn("name", JSColumn.TEXT, 100);
		c.allowNull = false
		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)
 
columnName type length ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow 
createNewColumnname

createNewColumn(columnName, type, length, allowNull)

tr

idclassdes Table Cell (td) DivsIndentCreates 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 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
Table Row (tr)id returns null.prs

Table Cell (td)class

Parameters

Div Table Body (tbody)
idcreateNewColumn-String_Number_Number_Boolean_Boolean
Table Row (tr)
idname
Table Cell (td)

createNewColumn

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
JSColumnObject
Span
stylefont-weight: bold;
createNewColumn
SpansIndent{String} columnName
{Number} type
{Number} length
{Boolean} allowNull
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
JSColumnObject
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)
	{
		var pk = table.createNewColumn("id", JSColumn.MEDIA, 16); // can also use (JSColumn.TEXT, 36) for UUIDs
		pk.rowIdentifierType = JSColumn.PK_COLUMN;
		pk.setFlag(JSColumn.UUID_COLUMN, true)
		pk.sequenceType = JSColumn.UUID_GENERATOR
		var c = table.createNewColumn("name", JSColumn.TEXT, 100);
		c.allowNull = false
		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)
 
columnName type length allowNull ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow 
createNewColumnname

createNewColumn(columnName, type, length, allowNull, pkColumn)

tr

idclassdes Table Cell (td) DivsIndentCreates 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 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
Table Row (tr)id returns null.tdprs

Parameters

Divclass

sIndent{String} columnName
{Number} type
{Number} length
{Boolean} allowNull
{Boolean} pkColumn

Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
JSColumnObject
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)
	{
		var pk = table.createNewColumn("id", JSColumn.MEDIA, 16); // can also use (JSColumn.TEXT, 36) for UUIDs
		pk.rowIdentifierType = JSColumn.PK_COLUMN;
		pk.setFlag(JSColumn.UUID_COLUMN, true)
		pk.sequenceType = JSColumn.UUID_GENERATOR
		var c = table.createNewColumn("name", JSColumn.TEXT, 100);
		c.allowNull = false
		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-String
Table Row (tr)
idname
Table Cell (td)

deleteColumn

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
void
Span
stylefont-weight: bold;
deleteColumn
Span
(columnName)
Table Row (tr)
iddes
Table Cell (td) Div
classsIndent
columnName type length allowNull pkColumn ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow 
deleteColumnname

deleteColumn(columnName)

dessIndentDeletes the column with the specified name from this table. The column is not actually deleted from the database until this

Table Row (tr)id table is synchronized with the database using the JSServer.synchronizeWithDB method.tdprs

Parameters

Divclass Table Row (tr)
idret
td

sIndent{String} columnNamecolumnName ret

Returns

divsIndentclients

classid

Supported Clients

sIndent
void Table Row (tr)SmartClient,WebClient,NGClientsam

Table Cell (td)

Table Row (tr)
classlastDetailRow
Table Cell (td)
 
Table Body (tbody)
idgetColumn-String
Table Row (tr)
idname
Table Cell (td)

getColumn

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
JSColumn
Span
stylefont-weight: bold;
getColumn
Span
(name)
Table Row (tr)
iddes
Table Cell (td) Div
classsIndent

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)idsIdentjavascriptlastDetailRow getColumnname

getColumn(name)

dessIndentReturns a JSColumn for the named column (or column dataproviderID).
prs

Table Cell (td)class

Parameters

DivsIndent{String} name - Table Row (tr)idThe name of the column to return the value from.tdret

Returns

divsIndentclients

classsIndent
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
Table Row (tr)
idname
Table Cell (td)

getColumnNames

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
String[]
Span
stylefont-weight: bold;
getColumnNames
Span
()
Table Row (tr)
iddes
Table Cell (td) Div
classsIndent
Table Row (tr)id

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow 
getColumnNamesname

getColumnNames()

dessIndentReturns an array containing the names of all table columns.
tdret

Returns

divsIndentclients

classsIndent
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
Table Row (tr)
idname
Table Cell (td)

getDataSource

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
String
Span
stylefont-weight: bold;
getDataSource
Span
()
Table Row (tr)
iddes
Table Cell (td) Div
classsIndent
Table Row (tr)id

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow 
getDataSourcename

getDataSource()

dessIndentReturns the table data source uri.
tdret

Returns

divsIndentclients

classsIndent
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
Table Row (tr)
idname
Table Cell (td)

getQuotedSQLName

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
String
Span
stylefont-weight: bold;
getQuotedSQLName
Span
()
Table Row (tr)
iddes
Table Cell (td) Div
classsIndent
Table Row (tr)id

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow 
getQuotedSQLNamename

getQuotedSQLName()

dessIndentReturns a quoted version of the table name, if necessary, as defined by the actual database used.
tdret

Returns

divsIndentclients

class

Supported Clients

sIndent
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
Table Row (tr)
idname
Table Cell (td)

getRowIdentifierColumnNames

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
String[]
Span
stylefont-weight: bold;
getRowIdentifierColumnNames
Span
()
Table Row (tr)
iddes
Table Cell (td) Div
classsIndent
Table Row (tr)idSmartClient,WebClient,NGClientsam

Sample

sIdentjavascript
lastDetailRow 
getRowIdentifierColumnNamesname

getRowIdentifierColumnNames()

dessIndentReturns an array containing the names of the identifier (PK) column(s).
tdret

Returns

div
Table Body (tbody)
idgetSQLName
Table Row (tr)
idname
Table Cell (td)

getSQLName

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
String
Span
stylefont-weight: bold;
getSQLName
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Returns the table name.
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
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
Table Row (tr)
idname
Table Cell (td)

getServerName

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
String
Span
stylefont-weight: bold;
getServerName
Span
()
Table Row (tr)
iddes
Table Cell (td)
Div
classsIndent
Returns the Servoy server name.
Table Row (tr)
idret
Table Cell (td)

Returns

Div
classsIndent
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)
 
Table Body (tbody)
idisMetadataTable
Table Row (tr)
idname
Table Cell (td)

isMetadataTable

Table Row (tr)
idsig
Table Cell (td)
Span
stylemargin-right: 5px;
Boolean
Span
stylefont-weight: bold;
isMetadataTable
Span
()
Table Row (tr)
iddes
Table Cell (td) Div
classsIndent
sIndentclients

classsIndent
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)
 

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow 
getSQLNamename

getSQLName()

dessIndentReturns the table name.ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow 
getServerNamename

getServerName()

dessIndentReturns the Servoy server name.ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow 
isMetadataTablename

isMetadataTable()

dessIndentReturns whether table was flagged as metadata table.
Table Row (tr)idtdret

Returns

div
Table Row (tr)
idsam
Table Cell (td)

Sample

Div
classsIndent
Code Block
languagejavascript
var jsTable = databaseManager.getTable('udm', 'campaigns')
var isMetaDataTable = jsTable.isMetadataTable()
Table Row (tr)
classlastDetailRow
Table Cell (td) sIndentclients

classsIndent
Boolean - boolean is metadata

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow