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 sReturnTypes
Table Row (tr)
styleheight: 30px;
Table Head (th)
Return Types
Table Row (tr)
Table Cell (td)
Span
classsWordList
JSFoundset
Span
classsWordList
JSColumn
Span
classsWordList
JSDataSet
Span
classsWordList
JSFoundSetUpdater
Span
classsWordList
JSTable
Span
classsWordList
JSRecord
Span
classsWordList
SQL_ACTION_TYPES

HTML Table
classservoy sSummary
Colgroup Tag
Column
padding0px
width80px

Column

Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan2
Property Summary
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Boolean
Table Cell (td)
#nullColumnValidatorEnabled
Enable/disable the default null validator for non null columns, makes it possible todo the checks later on when saving, when for example autosave is disabled.

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)
Boolean
Table Cell (td)
#acquireLock(foundset, record_index, [lock_name])
Request lock(s) for a foundset, can be a normal or related foundset.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Boolean
Table Cell (td)
#addTableFilterParam(server_name, table_name, dataprovider, operator, value, [filter_name])
Adds a filter to all the foundsets based on a table.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
void
Table Cell (td)
#addTrackingInfo(columnName, value)
Add tracking info used in the log table.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Boolean
Table Cell (td)
#commitTransaction()
Returns true if a transaction is committed; rollback if commit fails.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Boolean
Table Cell (td)
#commitTransaction(saveFirst)
Returns true if a transaction is committed; rollback if commit fails.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
JSFoundset
Table Cell (td)
#convertFoundSet(foundset, related)
Creates a foundset that combines all the records of the specified one-to-many relation seen from the given parent/primary foundset.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
JSDataSet
Table Cell (td)
#convertToDataSet(array/ids_string/foundset, [array_with_dataprovider_names])
Converts the argument to a JSDataSet, possible use in controller.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Boolean
Table Cell (td)
#copyMatchingColumns(src_record, dest_record, [overwrite/array_of_names_not_overwritten])
Copies all matching non empty columns (if overwrite boolean is given all columns except pk/ident, if array then all columns except pk and array names).
Table Body (tbody)
Table Row (tr)
Table Cell (td)
String
Table Cell (td)
#createDataSourceByQuery(name, server_name, sql_query, arguments, max_returned_rows)
Performs a sql query on the specified server, saves the the result in a datasource.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
JSDataSet
Table Cell (td)
#createEmptyDataSet(row_count, columnCount/array_with_column_names)
Returns an empty dataset object.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Boolean
Table Cell (td)
#dataSourceExists(datasource)
Check wether a data source exists.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Boolean
Table Cell (td)
#getAutoSave()
Returns true or false if autosave is enabled or disabled.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
JSDataSet
Table Cell (td)
#getDataSetByQuery(server_name, sql_query, arguments, max_returned_rows)
Performs a sql query on the specified server, returns the result in a dataset.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
String
Table Cell (td)
#getDataSourceServerName(dataSource)
Returns the server name from the datasource, or null if not a database datasource.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
String
Table Cell (td)
#getDataSourceTableName(dataSource)
Returns the table name from the datasource, or null if not a database datasource.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
String
Table Cell (td)
#getDatabaseProductName(serverName)
Returns the database product name as supplied by the driver for a server.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
JSRecord[]
Table Cell (td)
#getEditedRecords()
Returns an array of edited records with outstanding (unsaved) data.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
JSRecord[]
Table Cell (td)
#getEditedRecords(foundset)
Returns an array of edited records with outstanding (unsaved) data.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
JSRecord[]
Table Cell (td)
#getFailedRecords()
Returns an array of records that fail after a save.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
JSRecord[]
Table Cell (td)
#getFailedRecords(foundset)
Returns an array of records that fail after a save.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
JSFoundset
Table Cell (td)
#getFoundSet(dataSource)
Returns a foundset object for a specified datasource or server and tablename.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
JSFoundset
Table Cell (td)
#getFoundSet(serverName, tableName)
Returns a foundset object for a specified datasource or server and tablename.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Number
Table Cell (td)
#getFoundSetCount(foundset)
Returns the total number of records in a foundset.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
JSFoundSetUpdater
Table Cell (td)
#getFoundSetUpdater(foundset)
Returns a JSFoundsetUpdater object that can be used to update all or a specific number of rows in the specified foundset.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Object
Table Cell (td)
#getNextSequence(dataSource|serverName, [tableName], columnName)
Gets the next sequence for a column which has a sequence defined in its column dataprovider properties.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
String
Table Cell (td)
#getSQL(foundset)
Returns the internal SQL which defines the specified (related)foundset.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
String
Table Cell (td)
#getSQL(foundset, includeFilters)
Returns the internal SQL which defines the specified (related)foundset.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Object[]
Table Cell (td)
#getSQLParameters(foundset)
Returns the internal SQL parameters, as an array, that are used to define the specified (related)foundset.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Object[]
Table Cell (td)
#getSQLParameters(foundset, includeFilters)
Returns the internal SQL parameters, as an array, that are used to define the specified (related)foundset.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
String[]
Table Cell (td)
#getServerNames()
Returns an array with all the server names used in the solution.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
JSTable
Table Cell (td)
#getTable(foundset/record/datasource, [table_name])
Returns the JSTable object from which more info can be obtained (like columns).
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Number
Table Cell (td)
#getTableCount(dataSource)
Returns the total number of records(rows) in a table.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Object[][]
Table Cell (td)
#getTableFilterParams(server_name, [filter_name])
Returns a two dimensional array object containing the table filter information currently applied to the servers tables.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
String[]
Table Cell (td)
#getTableNames(serverName)
Returns an array of all table names for a specified server.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
String[]
Table Cell (td)
#getViewNames(serverName)
Returns an array of all view names for a specified server.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Boolean
Table Cell (td)
#hasLocks([lock_name])
Returns true if the current client has any or the specified lock(s) acquired.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Boolean
Table Cell (td)
#hasNewRecords(foundset/record, [foundset_index])
Returns true if the argument (foundSet / record) has at least one row that was not yet saved in the database.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Boolean
Table Cell (td)
#hasRecordChanges(foundset/record, [foundset_index])
Returns true if the specified foundset, on a specific index or in any of its records, or the specified record has changes.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Boolean
Table Cell (td)
#hasRecords(foundset/record, [qualifiedRelationString])
Returns true if the (related)foundset exists and has records.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Boolean
Table Cell (td)
#hasTransaction()
Returns true if there is an transaction active for this client.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Boolean
Table Cell (td)
#mergeRecords(source_record, combined_destination_record, [columnnamesarray_to_copy])
Merge records from the same foundset, updates entire datamodel (via foreign type on columns) with destination
record pk, deletes source record.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
void
Table Cell (td)
#recalculate(foundsetOrRecord)
Can be used to recalculate a specified record or all rows in the specified foundset.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Boolean
Table Cell (td)
#refreshRecordFromDatabase(foundset, index)
Flushes the client data cache and requeries the data for a record (based on the record index) in a foundset or all records in the foundset.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Boolean
Table Cell (td)
#releaseAllLocks([lock_name])
Release all current locks the client has (optionally limited to named locks).
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Boolean
Table Cell (td)
#removeTableFilterParam(serverName, filterName)
Removes a previously defined table filter.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
void
Table Cell (td)
#rollbackEditedRecords([foundset/record])
Rolls back in memory edited records that are outstanding (not saved).
Table Body (tbody)
Table Row (tr)
Table Cell (td)
void
Table Cell (td)
#rollbackTransaction()
Rollback a transaction started by databaseManager.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
void
Table Cell (td)
#rollbackTransaction(rollbackEdited)
Rollback a transaction started by databaseManager.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Boolean
Table Cell (td)
#saveData([record/foundset])
Saves all outstanding (unsaved) data and exits the current record.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Boolean
Table Cell (td)
#setAutoSave(autoSave)
Set autosave, if false then no saves will happen by the ui (not including deletes!).
Table Body (tbody)
Table Row (tr)
Table Cell (td)
void
Table Cell (td)
#setCreateEmptyFormFoundsets()
Turnoff the initial form foundset record loading, set this in the solution open method.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
void
Table Cell (td)
#startTransaction()
Start a database transaction.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Boolean
Table Cell (td)
#switchServer(sourceName, destinationName)
Switches a named server to another named server with the same datamodel (recommended to be used in an onOpen method for a solution).

HTML Table
idproperty
classservoy sDetail
Colgroup Tag
Column
padding0px
width100%

Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan1
Property Details
Table Body (tbody)
idnullColumnValidatorEnabled
classnode
Table Row (tr)
idname
Table Cell (td)
nullColumnValidatorEnabled
Table Row (tr)
iddes
Table Cell (td)
Enable/disable the default null validator for non null columns, makes it possible todo the checks later on when saving, when for example autosave is disabled.
Table Row (tr)
idret
Table Cell (td)
Returns
Boolean
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
databaseManager.nullColumnValidatorEnabled = false;//disable

//test if enabled
if(databaseManager.nullColumnValidatorEnabled) application.output('null validation enabled')
Table Row (tr)
classlastDetailRow
Table Cell (td)


HTML Table
idfunction
classservoy sDetail
Colgroup Tag
Column
padding0px
width100%

Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan1
Method Details
Table Body (tbody)
idacquireLock
classnode
Table Row (tr)
idname
Table Cell (td)
acquireLock
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
Boolean
Span
stylefloat: left; font-weight: bold;
idiets
acquireLock
Span
stylefloat: left;
idiets
(foundset, record_index, [lock_name])
Table Row (tr)
iddes
Table Cell (td)

Request lock(s) for a foundset, can be a normal or related foundset.
The record_index can be -1 to lock all rows, 0 to lock the current row, or a specific row of > 0
Optionally name the lock(s) so that it can be referenced it in releaseAllLocks()

returns true if the lock could be acquired.

Table Row (tr)
idprs
Table Cell (td)
Parameters
foundset – The JSFoundset to get the lock for
record_index – The record index which should be locked.
[lock_name] – The name of the lock.
Table Row (tr)
idret
Table Cell (td)
Returns
Boolean – true if the lock could be acquired.
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
//locks the complete foundset
databaseManager.acquireLock(foundset,-1);

//locks the current row
databaseManager.acquireLock(foundset,0);

//locks all related orders for the current Customer
var success = databaseManager.acquireLock(Cust_to_Orders,-1);
if(!success)
{
  plugins.dialogs.showWarningDialog('Alert','Failed to get a lock','OK');
}
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idaddTableFilterParam
classnode
Table Row (tr)
idname
Table Cell (td)
addTableFilterParam
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
Boolean
Span
stylefloat: left; font-weight: bold;
idiets
addTableFilterParam
Span
stylefloat: left;
idiets
(server_name, table_name, dataprovider, operator, value, [filter_name])
Table Row (tr)
iddes
Table Cell (td)
Adds a filter to all the foundsets based on a table.
Note: if null is provided as the tablename the filter will be applied on all tables with the dataprovider name.
A dataprovider can have multiple filters defined, they will all be applied.
returns true if the tablefilter could be applied.
Table Row (tr)
idprs
Table Cell (td)
Parameters
server_name – The name of the database server connection for the specified table name.
table_name – The name of the specified table.
dataprovider – A specified dataprovider column name.
operator – One of "=, <, >, >=, <=, !=, LIKE, or IN" optionally augmented with modifiers "#" (ignore case) or "||=" (or-is-null).
value – The specified filter value.
[filter_name] – The specified name of the database table filter.
Table Row (tr)
idret
Table Cell (td)
Returns
Boolean – true if the tablefilter could be applied.
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
// Best way to call this in a global solution startup method, but filters may be added/removed at any time.
// Note that multiple filters can be added to the same dataprovider, they will all be applied.

// filter on messages table where messagesid>10, the filter has a name so it can be removed using databaseManager.removeTableFilterParam()
var success = databaseManager.addTableFilterParam('admin', 'messages', 'messagesid', '>', 10, 'higNumberedMessagesRule')

// all tables that have the companyid column should be filtered
var success = databaseManager.addTableFilterParam('crm', null, 'companyidid', '=', currentcompanyid)

// some filters with in-conditions
var success = databaseManager.addTableFilterParam('crm', 'products', 'productcode', 'in', [120, 144, 200])
var success = databaseManager.addTableFilterParam('crm', 'orders', 'countrycode', 'in', 'select country code from countries where region = "Europe"')

// you can use modifiers in the operator as well, filter on companies where companyname is null or equals-ignore-case 'servoy'
var success = databaseManager.addTableFilterParam('crm', 'companies', 'companyname', '#^||=', 'servoy')
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idaddTrackingInfo
classnode
Table Row (tr)
idname
Table Cell (td)
addTrackingInfo
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
void
Span
stylefloat: left; font-weight: bold;
idiets
addTrackingInfo
Span
stylefloat: left;
idiets
(columnName, value)
Table Row (tr)
iddes
Table Cell (td)
Add tracking info used in the log table.
When tracking is enabled and a new row is inserted in the log table,
if it has a column named 'columnName', its value will be set with 'value'
Table Row (tr)
idprs
Table Cell (td)
Parameters
{String} columnName – The name of the column in the log table, used for tracking info
{Object} value – The value to be set when inserting a new row in the log table, for the 'columnName' column
Table Row (tr)
idret
Table Cell (td)
Returns
void
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
databaseManager.addTrackingInfo('log_column_name', 'trackingInfo')
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idcommitTransaction
classnode
Table Row (tr)
idname
Table Cell (td)
commitTransaction
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
Boolean
Span
stylefloat: left; font-weight: bold;
idiets
commitTransaction
Span
stylefloat: left;
idiets
()
Table Row (tr)
iddes
Table Cell (td)
Returns true if a transaction is committed; rollback if commit fails.
Saves all edited records and commits the data.
Table Row (tr)
idret
Table Cell (td)
Returns
Boolean – if the transaction could be committed.
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
// starts a database transaction
databaseManager.startTransaction()
//Now let users input data

//when data has been entered do a commit or rollback if the data entry is canceld or the the commit did fail.  
if (cancel || !databaseManager.commitTransaction())
{
  databaseManager.rollbackTransaction();
}
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idcommitTransaction-Boolean
classnode
Table Row (tr)
idname
Table Cell (td)
commitTransaction
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
Boolean
Span
stylefloat: left; font-weight: bold;
idiets
commitTransaction
Span
stylefloat: left;
idiets
(saveFirst)
Table Row (tr)
iddes
Table Cell (td)
Returns true if a transaction is committed; rollback if commit fails.
Table Row (tr)
idprs
Table Cell (td)
Parameters
{Boolean} saveFirst – save edited records to the database first (default true)
Table Row (tr)
idret
Table Cell (td)
Returns
Boolean – if the transaction could be committed.
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
// starts a database transaction
databaseManager.startTransaction()
//Now let users input data

//when data has been entered do a commit or rollback if the data entry is canceld or the the commit did fail.  
if (cancel || !databaseManager.commitTransaction())
{
  databaseManager.rollbackTransaction();
}
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idconvertFoundSet
classnode
Table Row (tr)
idname
Table Cell (td)
convertFoundSet
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
JSFoundset
Span
stylefloat: left; font-weight: bold;
idiets
convertFoundSet
Span
stylefloat: left;
idiets
(foundset, related)
Table Row (tr)
iddes
Table Cell (td)
Creates a foundset that combines all the records of the specified one-to-many relation seen from the given parent/primary foundset.
Table Row (tr)
idprs
Table Cell (td)
Parameters
{Object} foundset – The JSFoundset to convert.
{Object} related – can be a one-to-many relation object or the name of a one-to-many relation
Table Row (tr)
idret
Table Cell (td)
Returns
JSFoundset – The converted JSFoundset.
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
// Convert in the order form a orders foundset into a orderdetails foundset, 
// that has all the orderdetails from all the orders in the foundset.
var convertedFoundSet = databaseManager.convertFoundSet(foundset,order_to_orderdetails);
// or var convertedFoundSet = databaseManager.convertFoundSet(foundset,"order_to_orderdetails");
forms.orderdetails.controller.showRecords(convertedFoundSet);
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idconvertToDataSet
classnode
Table Row (tr)
idname
Table Cell (td)
convertToDataSet
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
JSDataSet
Span
stylefloat: left; font-weight: bold;
idiets
convertToDataSet
Span
stylefloat: left;
idiets
(array/ids_string/foundset, [array_with_dataprovider_names])
Table Row (tr)
iddes
Table Cell (td)
Converts the argument to a JSDataSet, possible use in controller.loadRecords(dataset)
Table Row (tr)
idprs
Table Cell (td)
Parameters
array/ids_string/foundset – The data that should go into the JSDataSet.
[array_with_dataprovider_names] – Array with column names.
Table Row (tr)
idret
Table Cell (td)
Returns
JSDataSet – JSDataSet with the data.
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
// converts a foundset pks to a dataset
var dataset = databaseManager.convertToDataSet(foundset);
// converts a foundset to a dataset
//var dataset = databaseManager.convertToDataSet(foundset,['product_id','product_name']);
// converts an object array to a dataset
//var dataset = databaseManager.convertToDataSet(files,['name','path']);
// converts an array to a dataset
//var dataset = databaseManager.convertToDataSet(new Array(1,2,3,4,5,6));
// converts an string list to a dataset
//var dataset = databaseManager.convertToDataSet('4,5,6');
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idcopyMatchingColumns
classnode
Table Row (tr)
idname
Table Cell (td)
copyMatchingColumns
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
Boolean
Span
stylefloat: left; font-weight: bold;
idiets
copyMatchingColumns
Span
stylefloat: left;
idiets
(src_record, dest_record, [overwrite/array_of_names_not_overwritten])
Table Row (tr)
iddes
Table Cell (td)

Copies all matching non empty columns (if overwrite boolean is given all columns except pk/ident, if array then all columns except pk and array names).
returns true if no error did happen.

NOTE: This function could be used to store a copy of records in an archive table. Use the getRecord() function to get the record as an object.

Table Row (tr)
idprs
Table Cell (td)
Parameters
src_record – The source record to be copied.
dest_record – The destination record to copy to.
[overwrite/array_of_names_not_overwritten] – true (default false) if everything can be overwritten or an array of names that shouldnt be overwritten.
Table Row (tr)
idret
Table Cell (td)
Returns
Boolean – true if no errors happend.
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
for( var i = 1 ; i <= foundset.getSize() ; i++ )
{
	var srcRecord = foundset.getRecord(i);
	var destRecord = otherfoundset.getRecord(i);
	if (srcRecord == null || destRecord == null) break;
	databaseManager.copyMatchingColumns(srcRecord,destRecord,true)
}
//saves any outstanding changes to the dest foundset
controller.saveData();
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idcreateDataSourceByQuery
classnode
Table Row (tr)
idname
Table Cell (td)
createDataSourceByQuery
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
String
Span
stylefloat: left; font-weight: bold;
idiets
createDataSourceByQuery
Span
stylefloat: left;
idiets
(name, server_name, sql_query, arguments, max_returned_rows)
Table Row (tr)
iddes
Table Cell (td)
Performs a sql query on the specified server, saves the the result in a datasource.
Will throw an exception if anything went wrong when executing the query.
Column types in the datasource are inferred from the query result.
Table Row (tr)
idprs
Table Cell (td)
Parameters
{String} name – data source name
{String} server_name – The name of the server where the query should be executed.
{String} sql_query – The custom sql.
{Object[]} arguments – Specified arguments or null if there are no arguments.
{Number} max_returned_rows – The maximum number of rows returned by the query.
Table Row (tr)
idret
Table Cell (td)
Returns
String – datasource containing the results of the query or null if the parameters are wrong.
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var query = 'select address, city, country  from customers';
 var uri = databaseManager.createDataSourceByQuery('mydata', 'example_data', query, null, 999);

// the uri can be used to create a form using solution model
var myForm = solutionModel.newForm('newForm', uri, 'myStyleName', false, 800, 600)
myForm.newTextField('city', 140, 20, 140,20)

// the uri can be used to acces a foundset directly
var fs = databaseManager.getFoundSet(uri)
fs.loadAllRecords();
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idcreateEmptyDataSet
classnode
Table Row (tr)
idname
Table Cell (td)
createEmptyDataSet
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
JSDataSet
Span
stylefloat: left; font-weight: bold;
idiets
createEmptyDataSet
Span
stylefloat: left;
idiets
(row_count, columnCount/array_with_column_names)
Table Row (tr)
iddes
Table Cell (td)
Returns an empty dataset object.
Table Row (tr)
idprs
Table Cell (td)
Parameters
row_count – The number of rows in the DataSet object.
columnCount/array_with_column_names – Number of columns or the column names.
Table Row (tr)
idret
Table Cell (td)
Returns
JSDataSet – An empty JSDataSet with the initial sizes.
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
// gets an empty dataset with a specifed row and column count
var dataset = databaseManager.createEmptyDataSet(10,10)
// gets an empty dataset with a specifed row count and column array
var dataset2 = databaseManager.createEmptyDataSet(10,new Array ('a','b','c','d'))
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
iddataSourceExists
classnode
Table Row (tr)
idname
Table Cell (td)
dataSourceExists
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
Boolean
Span
stylefloat: left; font-weight: bold;
idiets
dataSourceExists
Span
stylefloat: left;
idiets
(datasource)
Table Row (tr)
iddes
Table Cell (td)
Check wether a data source exists. This function can be used for any type of data source (db-based, in-memory).
Table Row (tr)
idprs
Table Cell (td)
Parameters
datasource
Table Row (tr)
idret
Table Cell (td)
Returns
Boolean – boolean exists
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
if (!databaseManager.dataSourceExists(dataSource))
{
   // does not exist
}
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idgetAutoSave
classnode
Table Row (tr)
idname
Table Cell (td)
getAutoSave
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
Boolean
Span
stylefloat: left; font-weight: bold;
idiets
getAutoSave
Span
stylefloat: left;
idiets
()
Table Row (tr)
iddes
Table Cell (td)
Returns true or false if autosave is enabled or disabled.
Table Row (tr)
idret
Table Cell (td)
Returns
Boolean – true if autosave if enabled.
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
//Set autosave, if false then no saves will happen by the ui (not including deletes!). Until you call saveData or setAutoSave(true)
//Rollbacks in mem the records that were edited and not yet saved. Best used in combination with autosave false.
databaseManager.setAutoSave(false)
//Now let users input data

//On save or cancel, when data has been entered:
if (cancel) databaseManager.rollbackEditedRecords()
databaseManager.setAutoSave(true)
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idgetDataSetByQuery
classnode
Table Row (tr)
idname
Table Cell (td)
getDataSetByQuery
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
JSDataSet
Span
stylefloat: left; font-weight: bold;
idiets
getDataSetByQuery
Span
stylefloat: left;
idiets
(server_name, sql_query, arguments, max_returned_rows)
Table Row (tr)
iddes
Table Cell (td)
Performs a sql query on the specified server, returns the result in a dataset.
Will throw an exception if anything did go wrong when executing the query.
Table Row (tr)
idprs
Table Cell (td)
Parameters
{String} server_name – The name of the server where the query should be executed.
{String} sql_query – The custom sql.
{Object[]} arguments – Specified arguments or null if there are no arguments.
{Number} max_returned_rows – The maximum number of rows returned by the query.
Table Row (tr)
idret
Table Cell (td)
Returns
JSDataSet – The JSDataSet containing the results of the query.
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
//finds duplicate records in a specified foundset
var vQuery =" SELECT companiesid from companies where company_name IN (SELECT company_name from companies group bycompany_name having count(company_name)>1 )";
var vDataset = databaseManager.getDataSetByQuery(databaseManager.getDataSourceServerName(controller.getDataSource()), vQuery, null, 1000);
controller.loadRecords(vDataset);

var maxReturnedRows = 10;//useful to limit number of rows
var query = 'select c1,c2,c3 from test_table where start_date = ?';//do not use '.' or special chars in names or aliases if you want to access data by name
var args = new Array();
args[0] = order_date //or  new Date()
var dataset = databaseManager.getDataSetByQuery(databaseManager.getDataSourceServerName(controller.getDataSource()), query, args, maxReturnedRows);

// place in label: 
// elements.myLabel.text = '<html>'+dataset.getAsHTML()+'</html>';

//example to calc a strange total
global_total = 0;
for( var i = 1 ; i <= dataset.getMaxRowIndex() ; i++ )
{
	dataset.rowIndex = i;
	global_total = global_total + dataset.c1 + dataset.getValue(i,3);
}
//example to assign to dataprovider
//employee_salary = dataset.getValue(row,column)
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idgetDataSourceServerName
classnode
Table Row (tr)
idname
Table Cell (td)
getDataSourceServerName
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
String
Span
stylefloat: left; font-weight: bold;
idiets
getDataSourceServerName
Span
stylefloat: left;
idiets
(dataSource)
Table Row (tr)
iddes
Table Cell (td)
Returns the server name from the datasource, or null if not a database datasource.
Table Row (tr)
idprs
Table Cell (td)
Parameters
{String} dataSource – The datasource string to get the server name from.
Table Row (tr)
idret
Table Cell (td)
Returns
String – The servername of the datasource.
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var servername = databaseManager.getDataSourceServerName(datasource);
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idgetDataSourceTableName
classnode
Table Row (tr)
idname
Table Cell (td)
getDataSourceTableName
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
String
Span
stylefloat: left; font-weight: bold;
idiets
getDataSourceTableName
Span
stylefloat: left;
idiets
(dataSource)
Table Row (tr)
iddes
Table Cell (td)
Returns the table name from the datasource, or null if not a database datasource.
Table Row (tr)
idprs
Table Cell (td)
Parameters
{String} dataSource – The datasource string to get the tablename from.
Table Row (tr)
idret
Table Cell (td)
Returns
String – The tablename of the datasource.
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var tablename = databaseManager.getDataSourceTableName(datasource);
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idgetDatabaseProductName
classnode
Table Row (tr)
idname
Table Cell (td)
getDatabaseProductName
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
String
Span
stylefloat: left; font-weight: bold;
idiets
getDatabaseProductName
Span
stylefloat: left;
idiets
(serverName)
Table Row (tr)
iddes
Table Cell (td)

Returns the database product name as supplied by the driver for a server.

NOTE: For more detail on named server connections, see the chapter on Database Connections, beginning with the Introduction to database connections in the Servoy Developer User's Guide.

Table Row (tr)
idprs
Table Cell (td)
Parameters
{String} serverName – The specified name of the database server connection.
Table Row (tr)
idret
Table Cell (td)
Returns
String – A database product name.
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var databaseProductName = databaseManager.getDatabaseProductName(servername)
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idgetEditedRecords
classnode
Table Row (tr)
idname
Table Cell (td)
getEditedRecords
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
JSRecord[]
Span
stylefloat: left; font-weight: bold;
idiets
getEditedRecords
Span
stylefloat: left;
idiets
()
Table Row (tr)
iddes
Table Cell (td)

Returns an array of edited records with outstanding (unsaved) data.

NOTE: To return a dataset of outstanding (unsaved) edited data for each record, see JSRecord.getChangedData();
NOTE2: The fields focus may be lost in user interface in order to determine the edits.

Table Row (tr)
idret
Table Cell (td)
Returns
JSRecord[] – Array of outstanding/unsaved JSRecords.
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
//This method can be used to loop through all outstanding changes,
//the application.output line contains all the changed data, their tablename and primary key
var editr = databaseManager.getEditedRecords()
for (x=0;x<editr.length;x++)
{
	var ds = editr[x].getChangedData();
	var jstable = databaseManager.getTable(editr[x]);
	var tableSQLName = jstable.getSQLName();
	var pkrec = jstable.getRowIdentifierColumnNames().join(',');
	var pkvals = new Array();
	for (var j = 0; j < jstable.getRowIdentifierColumnNames().length; j++)
	{
		pkvals[j] = editr[x][jstable.getRowIdentifierColumnNames()[j]];
	}
	application.output('Table: '+tableSQLName +', PKs: '+ pkvals.join(',') +' ('+pkrec +')');
	// Get a dataset with outstanding changes on a record
	for( var i = 1 ; i <= ds.getMaxRowIndex() ; i++ )
	{
		application.output('Column: '+ ds.getValue(i,1) +', oldValue: '+ ds.getValue(i,2) +', newValue: '+ ds.getValue(i,3));
	}
}
//in most cases you will want to set autoSave back on now
databaseManager.setAutoSave(true);
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idgetEditedRecords-JSFoundset
classnode
Table Row (tr)
idname
Table Cell (td)
getEditedRecords
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
JSRecord[]
Span
stylefloat: left; font-weight: bold;
idiets
getEditedRecords
Span
stylefloat: left;
idiets
(foundset)
Table Row (tr)
iddes
Table Cell (td)

Returns an array of edited records with outstanding (unsaved) data.

NOTE: To return a dataset of outstanding (unsaved) edited data for each record, see JSRecord.getChangedData();
NOTE2: The fields focus may be lost in user interface in order to determine the edits.

Table Row (tr)
idprs
Table Cell (td)
Parameters
{JSFoundset} foundset – return edited records in the foundset only.
Table Row (tr)
idret
Table Cell (td)
Returns
JSRecord[] – Array of outstanding/unsaved JSRecords.
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
//This method can be used to loop through all outstanding changes in a foundset,
//the application.output line contains all the changed data, their tablename and primary key
var editr = databaseManager.getEditedRecords(foundset)
for (x=0;x<editr.length;x++)
{
	var ds = editr[x].getChangedData();
	var jstable = databaseManager.getTable(editr[x]);
	var tableSQLName = jstable.getSQLName();
	var pkrec = jstable.getRowIdentifierColumnNames().join(',');
	var pkvals = new Array();
	for (var j = 0; j < jstable.getRowIdentifierColumnNames().length; j++)
	{
		pkvals[j] = editr[x][jstable.getRowIdentifierColumnNames()[j]];
	}
	application.output('Table: '+tableSQLName +', PKs: '+ pkvals.join(',') +' ('+pkrec +')');
	// Get a dataset with outstanding changes on a record
	for( var i = 1 ; i <= ds.getMaxRowIndex() ; i++ )
	{
		application.output('Column: '+ ds.getValue(i,1) +', oldValue: '+ ds.getValue(i,2) +', newValue: '+ ds.getValue(i,3));
	}
}
databaseManager.saveData(foundset);//save all records from foundset
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idgetFailedRecords
classnode
Table Row (tr)
idname
Table Cell (td)
getFailedRecords
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
JSRecord[]
Span
stylefloat: left; font-weight: bold;
idiets
getFailedRecords
Span
stylefloat: left;
idiets
()
Table Row (tr)
iddes
Table Cell (td)
Returns an array of records that fail after a save.
Table Row (tr)
idret
Table Cell (td)
Returns
JSRecord[] – Array of failed JSRecords
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var array = databaseManager.getFailedRecords()
for( var i = 0 ; i < array.length ; i++ )
{
	var record = array[i];
	application.output(record.exception);
	if (record.exception.getErrorCode() == ServoyException.RECORD_VALIDATION_FAILED)
	{
		// exception thrown in pre-insert/update/delete event method
		var thrown = record.exception.getValue()
		application.output("Record validation failed: "+thrown)
	}
 // find out the table of the record (similar to getEditedRecords)
 var jstable = databaseManager.getTable(record);
 var tableSQLName = jstable.getSQLName();
 application.output('Table:'+tableSQLName+' in server:'+jstable.getServerName()+' failed to save.')
}
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idgetFailedRecords-JSFoundset
classnode
Table Row (tr)
idname
Table Cell (td)
getFailedRecords
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
JSRecord[]
Span
stylefloat: left; font-weight: bold;
idiets
getFailedRecords
Span
stylefloat: left;
idiets
(foundset)
Table Row (tr)
iddes
Table Cell (td)
Returns an array of records that fail after a save.
Table Row (tr)
idprs
Table Cell (td)
Parameters
{JSFoundset} foundset – return failed records in the foundset only.
Table Row (tr)
idret
Table Cell (td)
Returns
JSRecord[] – Array of failed JSRecords
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var array = databaseManager.getFailedRecords(foundset)
for( var i = 0 ; i < array.length ; i++ )
{
	var record = array[i];
	application.output(record.exception);
	if (record.exception.getErrorCode() == ServoyException.RECORD_VALIDATION_FAILED)
	{
		// exception thrown in pre-insert/update/delete event method
		var thrown = record.exception.getValue()
		application.output("Record validation failed: "+thrown)
	}
 // find out the table of the record (similar to getEditedRecords)
 var jstable = databaseManager.getTable(record);
 var tableSQLName = jstable.getSQLName();
 application.output('Table:'+tableSQLName+' in server:'+jstable.getServerName()+' failed to save.')
}
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idgetFoundSet-String
classnode
Table Row (tr)
idname
Table Cell (td)
getFoundSet
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
JSFoundset
Span
stylefloat: left; font-weight: bold;
idiets
getFoundSet
Span
stylefloat: left;
idiets
(dataSource)
Table Row (tr)
iddes
Table Cell (td)
Returns a foundset object for a specified datasource or server and tablename.
Table Row (tr)
idprs
Table Cell (td)
Parameters
{String} dataSource – The datasource to get a JSFoundset for.
Table Row (tr)
idret
Table Cell (td)
Returns
JSFoundset – A new JSFoundset for that datasource.
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
// type the foundset returned from the call with JSDoc, fill in the right server/tablename
/** @type {JSFoundset<db:/servername/tablename>} */
var fs = databaseManager.getFoundSet(controller.getDataSource())
var ridx = fs.newRecord()
var record = fs.getRecord(ridx)
record.emp_name = 'John'
databaseManager.saveData()
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idgetFoundSet-String_String
classnode
Table Row (tr)
idname
Table Cell (td)
getFoundSet
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
JSFoundset
Span
stylefloat: left; font-weight: bold;
idiets
getFoundSet
Span
stylefloat: left;
idiets
(serverName, tableName)
Table Row (tr)
iddes
Table Cell (td)
Returns a foundset object for a specified datasource or server and tablename.
Table Row (tr)
idprs
Table Cell (td)
Parameters
{String} serverName – The servername to get a JSFoundset for.
{String} tableName – The tablename for that server
Table Row (tr)
idret
Table Cell (td)
Returns
JSFoundset – A new JSFoundset for that datasource.
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
// type the foundset returned from the call with JSDoc, fill in the right server/tablename
/** @type {JSFoundset<db:/servername/tablename>} */
var fs = databaseManager.getFoundSet(controller.getDataSource())
var ridx = fs.newRecord()
var record = fs.getRecord(ridx)
record.emp_name = 'John'
databaseManager.saveData()
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idgetFoundSetCount
classnode
Table Row (tr)
idname
Table Cell (td)
getFoundSetCount
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
Number
Span
stylefloat: left; font-weight: bold;
idiets
getFoundSetCount
Span
stylefloat: left;
idiets
(foundset)
Table Row (tr)
iddes
Table Cell (td)

Returns the total number of records in a foundset.

NOTE: This can be an expensive operation (time-wise) if your resultset is large.

Table Row (tr)
idprs
Table Cell (td)
Parameters
{Object} foundset – The JSFoundset to get the count for.
Table Row (tr)
idret
Table Cell (td)
Returns
Number – the foundset count
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
//return the total number of records in a foundset.
databaseManager.getFoundSetCount(foundset);
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idgetFoundSetUpdater
classnode
Table Row (tr)
idname
Table Cell (td)
getFoundSetUpdater
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
JSFoundSetUpdater
Span
stylefloat: left; font-weight: bold;
idiets
getFoundSetUpdater
Span
stylefloat: left;
idiets
(foundset)
Table Row (tr)
iddes
Table Cell (td)
Returns a JSFoundsetUpdater object that can be used to update all or a specific number of rows in the specified foundset.
Table Row (tr)
idprs
Table Cell (td)
Parameters
{Object} foundset – The foundset to update.
Table Row (tr)
idret
Table Cell (td)
Returns
JSFoundSetUpdater – The JSFoundsetUpdater for the specified JSFoundset.
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
//1) update entire foundset
var fsUpdater = databaseManager.getFoundSetUpdater(foundset)
fsUpdater.setColumn('customer_type',1)
fsUpdater.setColumn('my_flag',0)
fsUpdater.performUpdate()

//2) update part of foundset, for example the first 4 row (starts with selected row)
var fsUpdater = databaseManager.getFoundSetUpdater(foundset)
fsUpdater.setColumn('customer_type',new Array(1,2,3,4))
fsUpdater.setColumn('my_flag',new Array(1,0,1,0))
fsUpdater.performUpdate()

//3) safely loop through foundset (starts with selected row)
controller.setSelectedIndex(1)
var count = 0
var fsUpdater = databaseManager.getFoundSetUpdater(foundset)
while(fsUpdater.next())
{
	fsUpdater.setColumn('my_flag',count++)
}
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idgetNextSequence
classnode
Table Row (tr)
idname
Table Cell (td)
getNextSequence
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
Object
Span
stylefloat: left; font-weight: bold;
idiets
getNextSequence
Span
stylefloat: left;
idiets
(dataSource|serverName, [tableName], columnName)
Table Row (tr)
iddes
Table Cell (td)

Gets the next sequence for a column which has a sequence defined in its column dataprovider properties.

NOTE: For more infomation on configuring the sequence for a column, see the section Auto enter options for a column from the Dataproviders chapter in the Servoy Developer User's Guide.

Table Row (tr)
idprs
Table Cell (td)
Parameters
dataSource|serverName – The datasource that points to the table which has the column with the sequence,
or the name of the server where the table can be found. If the name of the server
is specified, then a second optional parameter specifying the name of the table
must be used. If the datasource is specified, then the name of the table is not needed
as the second argument.
[tableName] – The name of the table that has the column with the sequence. Use this parameter
only if you specified the name of the server as the first parameter.
{String} columnName – The name of the column that has a sequence defined in its properties.
Table Row (tr)
idret
Table Cell (td)
Returns
Object – The next sequence for the column, null if there was no sequence for that column
or if there is no column with the given name.
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var seqDataSource = forms.seq_table.controller.getDataSource();
var nextValue = databaseManager.getNextSequence(seqDataSource, 'seq_table_value');
application.output(nextValue);

nextValue = databaseManager.getNextSequence(databaseManager.getDataSourceServerName(seqDataSource), databaseManager.getDataSourceTableName(seqDataSource), 'seq_table_value')
application.output(nextValue);
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idgetSQL-Object
classnode
Table Row (tr)
idname
Table Cell (td)
getSQL
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
String
Span
stylefloat: left; font-weight: bold;
idiets
getSQL
Span
stylefloat: left;
idiets
(foundset)
Table Row (tr)
iddes
Table Cell (td)
Returns the internal SQL which defines the specified (related)foundset.
Table filters are on by default.
Make sure to set the applicable filters when the sql is used in a loadRecords() call.
Table Row (tr)
idprs
Table Cell (td)
Parameters
{Object} foundset – The JSFoundset to get the sql for.
Table Row (tr)
idret
Table Cell (td)
Returns
String – String representing the sql of the JSFoundset.
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var sql = databaseManager.getSQL(foundset)
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idgetSQL-Object_Boolean
classnode
Table Row (tr)
idname
Table Cell (td)
getSQL
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
String
Span
stylefloat: left; font-weight: bold;
idiets
getSQL
Span
stylefloat: left;
idiets
(foundset, includeFilters)
Table Row (tr)
iddes
Table Cell (td)
Returns the internal SQL which defines the specified (related)foundset.
Optionally, the foundset and table filter params can be excluded in the sql (includeFilters=false).
Make sure to set the applicable filters when the sql is used in a loadRecords() call.
Table Row (tr)
idprs
Table Cell (td)
Parameters
{Object} foundset – The JSFoundset to get the sql for.
{Boolean} includeFilters – include the foundset and table filters.
Table Row (tr)
idret
Table Cell (td)
Returns
String – String representing the sql of the JSFoundset.
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var sql = databaseManager.getSQL(foundset)
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idgetSQLParameters-Object
classnode
Table Row (tr)
idname
Table Cell (td)
getSQLParameters
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
Object[]
Span
stylefloat: left; font-weight: bold;
idiets
getSQLParameters
Span
stylefloat: left;
idiets
(foundset)
Table Row (tr)
iddes
Table Cell (td)
Returns the internal SQL parameters, as an array, that are used to define the specified (related)foundset.
Parameters for the filters are included.
Table Row (tr)
idprs
Table Cell (td)
Parameters
{Object} foundset – The JSFoundset to get the sql parameters for.
Table Row (tr)
idret
Table Cell (td)
Returns
Object[] – An Array with the sql parameter values.
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var sqlParameterArray = databaseManager.getSQLParameters(foundset,false)
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idgetSQLParameters-Object_Boolean
classnode
Table Row (tr)
idname
Table Cell (td)
getSQLParameters
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
Object[]
Span
stylefloat: left; font-weight: bold;
idiets
getSQLParameters
Span
stylefloat: left;
idiets
(foundset, includeFilters)
Table Row (tr)
iddes
Table Cell (td)
Returns the internal SQL parameters, as an array, that are used to define the specified (related)foundset.
Table Row (tr)
idprs
Table Cell (td)
Parameters
{Object} foundset – The JSFoundset to get the sql parameters for.
{Boolean} includeFilters – include the parameters for the filters.
Table Row (tr)
idret
Table Cell (td)
Returns
Object[] – An Array with the sql parameter values.
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var sqlParameterArray = databaseManager.getSQLParameters(foundset,false)
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idgetServerNames
classnode
Table Row (tr)
idname
Table Cell (td)
getServerNames
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
String[]
Span
stylefloat: left; font-weight: bold;
idiets
getServerNames
Span
stylefloat: left;
idiets
()
Table Row (tr)
iddes
Table Cell (td)

Returns an array with all the server names used in the solution.

NOTE: For more detail on named server connections, see the chapter on Database Connections, beginning with the Introduction to database connections in the Servoy Developer User's Guide.

Table Row (tr)
idret
Table Cell (td)
Returns
String[] – An Array of servernames.
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var array = databaseManager.getServerNames()
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idgetTable
classnode
Table Row (tr)
idname
Table Cell (td)
getTable
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
JSTable
Span
stylefloat: left; font-weight: bold;
idiets
getTable
Span
stylefloat: left;
idiets
(foundset/record/datasource, [table_name])
Table Row (tr)
iddes
Table Cell (td)
Returns the JSTable object from which more info can be obtained (like columns).
The parameter can be a JSFoundset,JSRecord,datasource string or server/tablename combination.
Table Row (tr)
idprs
Table Cell (td)
Parameters
foundset/record/datasource – (only db-defined)/server_name The data where the JSTable can be get from.
[table_name] – The tablename of the first param is a servername string.
Table Row (tr)
idret
Table Cell (td)
Returns
JSTable – the JSTable get from the input.
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var jstable = databaseManager.getTable(controller.getDataSource());
//var jstable = databaseManager.getTable(foundset);
//var jstable = databaseManager.getTable(record);
//var jstable = databaseManager.getTable(datasource);
var tableSQLName = jstable.getSQLName();
var columnNamesArray = jstable.getColumnNames();
var firstColumnName = columnNamesArray[0];
var jscolumn = jstable.getColumn(firstColumnName);
var columnLength = jscolumn.getLength();
var columnType = jscolumn.getTypeAsString();
var columnSQLName = jscolumn.getSQLName();
var isPrimaryKey = jscolumn.isRowIdentifier();
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idgetTableCount
classnode
Table Row (tr)
idname
Table Cell (td)
getTableCount
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
Number
Span
stylefloat: left; font-weight: bold;
idiets
getTableCount
Span
stylefloat: left;
idiets
(dataSource)
Table Row (tr)
iddes
Table Cell (td)

Returns the total number of records(rows) in a table.

NOTE: This can be an expensive operation (time-wise) if your resultset is large

Table Row (tr)
idprs
Table Cell (td)
Parameters
{Object} dataSource – Data where a server table can be get from. Can be a foundset, a datasource name or a JSTable.
Table Row (tr)
idret
Table Cell (td)
Returns
Number – the total table count.
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
//return the total number of rows in a table.
var count = databaseManager.getTableCount(foundset);
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idgetTableFilterParams
classnode
Table Row (tr)
idname
Table Cell (td)
getTableFilterParams
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
Object[][]
Span
stylefloat: left; font-weight: bold;
idiets
getTableFilterParams
Span
stylefloat: left;
idiets
(server_name, [filter_name])
Table Row (tr)
iddes
Table Cell (td)
Returns a two dimensional array object containing the table filter information currently applied to the servers tables.
The "columns" of a row from this array are: tablename,dataprovider,operator,value,tablefilername
Table Row (tr)
idprs
Table Cell (td)
Parameters
server_name – The name of the database server connection.
[filter_name] – The filter name for which to get the array.
Table Row (tr)
idret
Table Cell (td)
Returns
Object[][] – Two dimensional array.
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var params = databaseManager.getTableFilterParams(databaseManager.getDataSourceServerName(controller.getDataSource()))
for (var i = 0; params != null && i < params.length; i++)
{
	application.output('Table filter on table ' + params[i][0]+ ': '+ params[i][1]+ ' '+params[i][2]+ ' '+params[i][3] +(params[i][4] == null ? ' [no name]' : ' ['+params[i][4]+']'))
}
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idgetTableNames
classnode
Table Row (tr)
idname
Table Cell (td)
getTableNames
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
String[]
Span
stylefloat: left; font-weight: bold;
idiets
getTableNames
Span
stylefloat: left;
idiets
(serverName)
Table Row (tr)
iddes
Table Cell (td)
Returns an array of all table names for a specified server.
Table Row (tr)
idprs
Table Cell (td)
Parameters
{String} serverName – The server name to get the table names from.
Table Row (tr)
idret
Table Cell (td)
Returns
String[] – An Array with the tables names of that server.
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
//return all the table names as array
var tableNamesArray = databaseManager.getTableNames('user_data');
var firstTableName = tableNamesArray[0];
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idgetViewNames
classnode
Table Row (tr)
idname
Table Cell (td)
getViewNames
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
String[]
Span
stylefloat: left; font-weight: bold;
idiets
getViewNames
Span
stylefloat: left;
idiets
(serverName)
Table Row (tr)
iddes
Table Cell (td)
Returns an array of all view names for a specified server.
Table Row (tr)
idprs
Table Cell (td)
Parameters
{String} serverName – The server name to get the view names from.
Table Row (tr)
idret
Table Cell (td)
Returns
String[] – An Array with the view names of that server.
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
//return all the view names as array
var viewNamesArray = databaseManager.getViewNames('user_data');
var firstViewName = viewNamesArray[0];
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idhasLocks
classnode
Table Row (tr)
idname
Table Cell (td)
hasLocks
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
Boolean
Span
stylefloat: left; font-weight: bold;
idiets
hasLocks
Span
stylefloat: left;
idiets
([lock_name])
Table Row (tr)
iddes
Table Cell (td)
Returns true if the current client has any or the specified lock(s) acquired.
Table Row (tr)
idprs
Table Cell (td)
Parameters
[lock_name] – The lock name to check.
Table Row (tr)
idret
Table Cell (td)
Returns
Boolean – true if the current client has locks or the lock.
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var hasLocks = databaseManager.hasLocks('mylock')
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idhasNewRecords
classnode
Table Row (tr)
idname
Table Cell (td)
hasNewRecords
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
Boolean
Span
stylefloat: left; font-weight: bold;
idiets
hasNewRecords
Span
stylefloat: left;
idiets
(foundset/record, [foundset_index])
Table Row (tr)
iddes
Table Cell (td)
Returns true if the argument (foundSet / record) has at least one row that was not yet saved in the database.
Table Row (tr)
idprs
Table Cell (td)
Parameters
foundset/record – The JSFoundset or JSRecord to test.
[foundset_index] – The record index in the foundset to test (not specified means has the foundset any new records)
Table Row (tr)
idret
Table Cell (td)
Returns
Boolean – true if the JSFoundset has new records or JSRecord is a new record.
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var fs = databaseManager.getFoundSet(databaseManager.getDataSourceServerName(controller.getDataSource()),'employees');
	databaseManager.startTransaction();
	var ridx = fs.newRecord();
	var record = fs.getRecord(ridx);
	record.emp_name = 'John';
	if (databaseManager.hasNewRecords(fs)) {
		application.output("new records");
	} else {
		application.output("no new records");
	}
	databaseManager.saveData();
	databaseManager.commitTransaction();
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idhasRecordChanges
classnode
Table Row (tr)
idname
Table Cell (td)
hasRecordChanges
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
Boolean
Span
stylefloat: left; font-weight: bold;
idiets
hasRecordChanges
Span
stylefloat: left;
idiets
(foundset/record, [foundset_index])
Table Row (tr)
iddes
Table Cell (td)

Returns true if the specified foundset, on a specific index or in any of its records, or the specified record has changes.

NOTE: The fields focus may be lost in user interface in order to determine the edits.

Table Row (tr)
idprs
Table Cell (td)
Parameters
foundset/record – The JSFoundset or JSRecord to test if it has changes.
[foundset_index] – The record index in the foundset to test (not specified means has the foundset any changed records)
Table Row (tr)
idret
Table Cell (td)
Returns
Boolean – true if there are changes in the JSFoundset or JSRecord.
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
if (databaseManager.hasRecordChanges(foundset,2))
{
	//do save or something else
}
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idhasRecords
classnode
Table Row (tr)
idname
Table Cell (td)
hasRecords
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
Boolean
Span
stylefloat: left; font-weight: bold;
idiets
hasRecords
Span
stylefloat: left;
idiets
(foundset/record, [qualifiedRelationString])
Table Row (tr)
iddes
Table Cell (td)
Returns true if the (related)foundset exists and has records.
Table Row (tr)
idprs
Table Cell (td)
Parameters
foundset/record – A JSFoundset to test or a JSRecord for which to test a relation
[qualifiedRelationString] – The relationname if the first param is a JSRecord.
Table Row (tr)
idret
Table Cell (td)
Returns
Boolean – true if the foundset/relation has records.
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
if (elements.customer_id.hasRecords(orders_to_orderitems))
{
	//do work on relatedFoundSet
}
//if (elements.customer_id.hasRecords(foundset.getSelectedRecord(),'orders_to_orderitems.orderitems_to_products'))
//{
//	//do work on deeper relatedFoundSet
//}
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idhasTransaction
classnode
Table Row (tr)
idname
Table Cell (td)
hasTransaction
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
Boolean
Span
stylefloat: left; font-weight: bold;
idiets
hasTransaction
Span
stylefloat: left;
idiets
()
Table Row (tr)
iddes
Table Cell (td)
Returns true if there is an transaction active for this client.
Table Row (tr)
idret
Table Cell (td)
Returns
Boolean – true if the client has a transaction.
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var hasTransaction = databaseManager.hasTransaction()
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idmergeRecords
classnode
Table Row (tr)
idname
Table Cell (td)
mergeRecords
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
Boolean
Span
stylefloat: left; font-weight: bold;
idiets
mergeRecords
Span
stylefloat: left;
idiets
(source_record, combined_destination_record, [columnnamesarray_to_copy])
Table Row (tr)
iddes
Table Cell (td)

Merge records from the same foundset, updates entire datamodel (via foreign type on columns) with destination
record pk, deletes source record. Do use a transaction!

This function is very handy in situations where duplicate data exists. It allows you to merge the two records
and move all related records in one go. Say the source_record is "Ikea" and the combined_destination_record is "IKEA", the
"Ikea" record is deleted and all records related to it (think of contacts and orders, for instance) will be related
to the "IKEA" record.

The function takes an optional array of column names. If provided, the data in the named columns will be copied
from source_record to combined_destination_record.

Note that it is essential for both records to originate from the same foundset, as shown in the sample code.

Table Row (tr)
idprs
Table Cell (td)
Parameters
source_record – The source JSRecord to copy from.
combined_destination_record – The target/destination JSRecord to copy into.
[columnnamesarray_to_copy] – The column names Array that should be copied.
Table Row (tr)
idret
Table Cell (td)
Returns
Boolean – true if the records could me merged.
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
databaseManager.mergeRecords(foundset.getRecord(1),foundset.getRecord(2));
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idrecalculate
classnode
Table Row (tr)
idname
Table Cell (td)
recalculate
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
void
Span
stylefloat: left; font-weight: bold;
idiets
recalculate
Span
stylefloat: left;
idiets
(foundsetOrRecord)
Table Row (tr)
iddes
Table Cell (td)
Can be used to recalculate a specified record or all rows in the specified foundset.
May be necessary when data is changed from outside of servoy, or when there is data changed inside servoy
but records with calculations depending on that data where not loaded so not updated and you need to update
the stored calculation values because you are depending on that with queries or aggregates.
Table Row (tr)
idprs
Table Cell (td)
Parameters
{Object} foundsetOrRecord – JSFoundset or JSRecord to recalculate.
Table Row (tr)
idret
Table Cell (td)
Returns
void
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
// recalculate one record from a foundset.
databaseManager.recalculate(foundset.getRecord(1));
// recalculate all records from the foundset.
// please use with care, this can be expensive!
//databaseManager.recalculate(foundset);
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idrefreshRecordFromDatabase
classnode
Table Row (tr)
idname
Table Cell (td)
refreshRecordFromDatabase
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
Boolean
Span
stylefloat: left; font-weight: bold;
idiets
refreshRecordFromDatabase
Span
stylefloat: left;
idiets
(foundset, index)
Table Row (tr)
iddes
Table Cell (td)
Flushes the client data cache and requeries the data for a record (based on the record index) in a foundset or all records in the foundset.
Used where a program external to Servoy has modified the database record.
Record index of -1 will refresh all records in the foundset and 0 the selected record.
Table Row (tr)
idprs
Table Cell (td)
Parameters
{Object} foundset – The JSFoundset to refresh
{Number} index – The index of the JSRecord that must be refreshed (or -1 for all).
Table Row (tr)
idret
Table Cell (td)
Returns
Boolean – true if the refresh was done.
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
//refresh the second record from the foundset.
databaseManager.refreshRecordFromDatabase(foundset,2)
//flushes all records in the related foundset  (-1 is or can be an expensive operation)
databaseManager.refreshRecordFromDatabase(order_to_orderdetails,-1);
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idreleaseAllLocks
classnode
Table Row (tr)
idname
Table Cell (td)
releaseAllLocks
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
Boolean
Span
stylefloat: left; font-weight: bold;
idiets
releaseAllLocks
Span
stylefloat: left;
idiets
([lock_name])
Table Row (tr)
iddes
Table Cell (td)
Release all current locks the client has (optionally limited to named locks).
return true if the locks are released.
Table Row (tr)
idprs
Table Cell (td)
Parameters
[lock_name] – The lock name to release.
Table Row (tr)
idret
Table Cell (td)
Returns
Boolean – true if all locks or the lock is released.
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
databaseManager.releaseAllLocks('mylock')
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idremoveTableFilterParam
classnode
Table Row (tr)
idname
Table Cell (td)
removeTableFilterParam
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
Boolean
Span
stylefloat: left; font-weight: bold;
idiets
removeTableFilterParam
Span
stylefloat: left;
idiets
(serverName, filterName)
Table Row (tr)
iddes
Table Cell (td)
Removes a previously defined table filter.
Table Row (tr)
idprs
Table Cell (td)
Parameters
{String} serverName – The name of the database server connection.
{String} filterName – The name of the filter that should be removed.
Table Row (tr)
idret
Table Cell (td)
Returns
Boolean – true if the filter could be removed.
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var success = databaseManager.removeTableFilterParam('admin', 'higNumberedMessagesRule')
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idrollbackEditedRecords
classnode
Table Row (tr)
idname
Table Cell (td)
rollbackEditedRecords
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
void
Span
stylefloat: left; font-weight: bold;
idiets
rollbackEditedRecords
Span
stylefloat: left;
idiets
([foundset/record])
Table Row (tr)
iddes
Table Cell (td)
Rolls back in memory edited records that are outstanding (not saved).
Can specify a record or foundset as parameter to rollback.
Best used in combination with the function databaseManager.setAutoSave()
This does not include deletes, they do not honor the autosafe false flag so they cant be rollbacked by this call.
Table Row (tr)
idprs
Table Cell (td)
Parameters
[foundset/record] – A JSFoundset or a JSRecord to rollback
Table Row (tr)
idret
Table Cell (td)
Returns
void
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
//Set autosave, if false then no saves will happen by the ui (not including deletes!). Until you call saveData or setAutoSave(true)
//Rollbacks in mem the records that were edited and not yet saved. Best used in combination with autosave false.
databaseManager.setAutoSave(false)
//Now let users input data

//On save or cancel, when data has been entered:
if (cancel) databaseManager.rollbackEditedRecords()
//databaseManager.rollbackEditedRecords(foundset); // rollback all records from foundset
//databaseManager.rollbackEditedRecords(foundset.getSelectedRecord()); // rollback only one record
databaseManager.setAutoSave(true)
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idrollbackTransaction
classnode
Table Row (tr)
idname
Table Cell (td)
rollbackTransaction
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
void
Span
stylefloat: left; font-weight: bold;
idiets
rollbackTransaction
Span
stylefloat: left;
idiets
()
Table Row (tr)
iddes
Table Cell (td)
Rollback a transaction started by databaseManager.startTransaction().
Note that when autosave is false, rollbackEditedRecords() will not handle deleted records, while rollbackTransaction() does.
Also, rollbackEditedRecords() is called before rolling back the transaction.
Table Row (tr)
idret
Table Cell (td)
Returns
void
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
// starts a database transaction
databaseManager.startTransaction()
//Now let users input data

//when data has been entered do a commit or rollback if the data entry is canceld or the the commit did fail.  
if (cancel || !databaseManager.commitTransaction())
{
  databaseManager.rollbackTransaction();
}
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idrollbackTransaction-Boolean
classnode
Table Row (tr)
idname
Table Cell (td)
rollbackTransaction
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
void
Span
stylefloat: left; font-weight: bold;
idiets
rollbackTransaction
Span
stylefloat: left;
idiets
(rollbackEdited)
Table Row (tr)
iddes
Table Cell (td)
Rollback a transaction started by databaseManager.startTransaction().
Note that when autosave is false, rollbackEditedRecords() will not handle deleted records, while rollbackTransaction() does.
Table Row (tr)
idprs
Table Cell (td)
Parameters
{Boolean} rollbackEdited – call rollbackEditedRecords() before rolling back the transaction
Table Row (tr)
idret
Table Cell (td)
Returns
void
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
// starts a database transaction
databaseManager.startTransaction()
//Now let users input data

//when data has been entered do a commit or rollback if the data entry is canceld or the the commit did fail.  
if (cancel || !databaseManager.commitTransaction())
{
  databaseManager.rollbackTransaction();
}
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idsaveData
classnode
Table Row (tr)
idname
Table Cell (td)
saveData
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
Boolean
Span
stylefloat: left; font-weight: bold;
idiets
saveData
Span
stylefloat: left;
idiets
([record/foundset])
Table Row (tr)
iddes
Table Cell (td)

Saves all outstanding (unsaved) data and exits the current record.
Optionally, by specifying a record or foundset, can save a single record or all reacords from foundset instead of all the data.

NOTE: The fields focus may be lost in user interface in order to determine the edits.

Table Row (tr)
idprs
Table Cell (td)
Parameters
[record/foundset] – The JSRecord to save.
Table Row (tr)
idret
Table Cell (td)
Returns
Boolean – true if the save was done without an error.
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
databaseManager.saveData();
//databaseManager.saveData(foundset.getRecord(1));//save specific record
//databaseManager.saveData(foundset);//save all records from foundset
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idsetAutoSave
classnode
Table Row (tr)
idname
Table Cell (td)
setAutoSave
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
Boolean
Span
stylefloat: left; font-weight: bold;
idiets
setAutoSave
Span
stylefloat: left;
idiets
(autoSave)
Table Row (tr)
iddes
Table Cell (td)

Set autosave, if false then no saves will happen by the ui (not including deletes!).
Until you call databaseManager.saveData() or setAutoSave(true)

If you also want to be able to rollback deletes then you have to use databaseManager.startTransaction().
Because even if autosave is false deletes of records will be done.

Table Row (tr)
idprs
Table Cell (td)
Parameters
{Boolean} autoSave – Boolean to enable or disable autosave.
Table Row (tr)
idret
Table Cell (td)
Returns
Boolean – false if the current edited record could not be saved.
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
//Rollbacks in mem the records that were edited and not yet saved. Best used in combination with autosave false.
databaseManager.setAutoSave(false)
//Now let users input data

//On save or cancel, when data has been entered:
if (cancel) databaseManager.rollbackEditedRecords()
databaseManager.setAutoSave(true)
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idsetCreateEmptyFormFoundsets
classnode
Table Row (tr)
idname
Table Cell (td)
setCreateEmptyFormFoundsets
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
void
Span
stylefloat: left; font-weight: bold;
idiets
setCreateEmptyFormFoundsets
Span
stylefloat: left;
idiets
()
Table Row (tr)
iddes
Table Cell (td)

Turnoff the initial form foundset record loading, set this in the solution open method.
Simular to calling foundset.clear() in the form's onload event.

NOTE: When the foundset record loading is turned off, controller.find or controller.loadAllRecords must be called to display the records

Table Row (tr)
idret
Table Cell (td)
Returns
void
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
//this has to be called in the solution open method
databaseManager.setCreateEmptyFormFoundsets()
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idstartTransaction
classnode
Table Row (tr)
idname
Table Cell (td)
startTransaction
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
void
Span
stylefloat: left; font-weight: bold;
idiets
startTransaction
Span
stylefloat: left;
idiets
()
Table Row (tr)
iddes
Table Cell (td)

Start a database transaction.
If you want to avoid round trips to the server or avoid the posibility of blocking other clients
because of your pending changes, you can use databaseManager.setAutoSave(false/true) and databaseManager.rollbackEditedRecords().

startTransaction, commit/rollbackTransacton() does support rollbacking of record deletes which autoSave = false doesnt support.

Table Row (tr)
idret
Table Cell (td)
Returns
void
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
// starts a database transaction
databaseManager.startTransaction()
//Now let users input data

//when data has been entered do a commit or rollback if the data entry is canceld or the the commit did fail.  
if (cancel || !databaseManager.commitTransaction())
{
  databaseManager.rollbackTransaction();
}
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idswitchServer
classnode
Table Row (tr)
idname
Table Cell (td)
switchServer
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
Boolean
Span
stylefloat: left; font-weight: bold;
idiets
switchServer
Span
stylefloat: left;
idiets
(sourceName, destinationName)
Table Row (tr)
iddes
Table Cell (td)
Switches a named server to another named server with the same datamodel (recommended to be used in an onOpen method for a solution).
return true if successful.
Table Row (tr)
idprs
Table Cell (td)
Parameters
{String} sourceName – The name of the source database server connection
{String} destinationName – The name of the destination database server connection.
Table Row (tr)
idret
Table Cell (td)
Returns
Boolean – true if the switch could be done.
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
//dynamically changes a server for the entire solution, destination database server must contain the same tables/columns!
//will fail if there is a lock, transaction , if repository_server is used or if destination server is invalid
//in the solution keep using the sourceName every where to reference the server!  
var success = databaseManager.switchServer('crm', 'crm1')
Table Row (tr)
classlastDetailRow
Table Cell (td)