IsDataSourceLocked
Definition:
IsDataSourceLocked(datasource)
Description:
Check whether an ADO Database Data Source table, Web API Data Source table or Custom Table is locked.
Platforms:
All
Parameters:
datasource - required
Specifies the Data Source to be acted on – click here for the format of this parameter.
Returns:
0
Table not locked.
1
Table is locked.
Notes:
-
When performing an asynchronous data transfer using the Synchronise Method, all local tables included in the transfer(s) are locked to prevent records becoming out of sync during the transfer(s). Locked records can still be read but they cannot be updated and new records cannot be created in a locked table. The tables will remain locked until the transaction has been fully processed or is cancelled. If a Scripting Method attempts to write data to a locked table an error message will be displayed at runtime. IsDataSourceLocked allows you to check within your Script whether a table is locked before you attempt to call a Method which would write to potentially locked tables.
This Method is, therefore, only relevant when using Synchronise to perform asynchronous data transfers involving Database Data Sources, Web API Data Sources and Custom Tables. Synchronous transfers, whether using Synchronise, SyncDataSource, LoadDatabase or LoadDataSource, pause operation of the app until the transfer completes and therefore do not require you to check whether tables are locked. Web Service and Predefined Data Sources cannot be used in asynchronous data transactions.
-
This Method is not relevant for use with Custom Views.
See also: