CountTables function
Returns the number of tables which the “TABLES” grid contains (including tables which are currently scrolled out of view, but excluding tables which are removed due to filtering or table group selection).
Synopsis
%table_cont = CountTables()
Parameters
(none)
Returns
The number of tables, i.e. the number of rows in the “TABLES” grid.
FindTable function
Searches for a table in the “TABLES” grid.
Synopsis
%table_index = FindTable("MyTable")
Parameters
|
Name |
Type |
Required? |
Description |
|---|---|---|---|
|
|
string |
yes |
The table alias name, or “*current” |
Returns
The row number (0-based offset from top) in the “TABLES” grid for the specified table, or -1 if the table is not contained in the grid.
Remarks
-
When
nameis set to "*current",FIndTablesearches for the currently selected table (if any). -
If the search doesn’t find a matching table,
FindTablereturns -1. -
Alias names are compared case insensitively.
GetOpenTableName function
Synopsis
%table_name = GetOpenTableName()
Parameters
(none)
Returns
The alias name of the currently open table.
If no table is currently open, returns an empty string.
GetTableInfo function
Returns a JSON object with information about the specified database table.
Synopsis
%table_info = GetTableInfo("MyDSN\MyTable")
Parameters
|
Name |
Type |
Required |
Description |
|---|---|---|---|
|
|
string or integer |
yes |
Specifies the table whose info is requested |
Returns
A JSON object like this:
{
"alias":"LocalHsc",
"dsn":"LocalHSc",
"name":"LocalHsc",
"index":0,
"media_dir":"C:\\ProgramData\\DigaSystem-Local\\Media\\LocalHSc",
"rights":
{
"read":true,
"use":true,
"create":true,
"change":true,
"soft_delete":true,
"hard_delete":true,
"align":false,
"no_broadcast":false,
"change_definitions":true
},
"db_version":5,
"change_number":1691,
"last_refno":776,
"classes_mask":4455419,
"classes":
{
"none":false,
"all":false,
"news":true,
"text":true,
"music":false,
"cart":true,
"advert":true,
"control":true,
"command":true,
"graphic":true,
"video":true,
"project":true,
"audio":false,
"story":true,
"magazine":true,
"promotion":true,
"live":true,
"line":true,
"info":true,
"video_project":true,
"sequoia_project":false,
"video_batch":false,
"zip":false,
"digacut_MT":false,
"undefined":true,
"digacut_ST":false
},
"state":["open"]
}
This is preliminary. Additional fields may be added.
Remarks
To specify the table, use one of the following ways:
-
Supply the table index, i.e. the 0-based row number in the “TABLES” grid.
-
Supply the table alias name.
-
Supply the database (DSN) name, followed by a backslash and the table name, like
"MyDSN\MyTable".
OpenTable procedure
Opens a table.
Synopsis
OpenTable(LocalTable, 5000)
Parameters
|
Name |
Type |
Required? |
Description |
|---|---|---|---|
|
|
string |
yes |
Table alias name |
|
|
number |
no |
Timeout in millisecs |
Returns
Nothing.
Remarks
-
If
timeoutis not specified or is 0 or negative,OpenTablereturns immediately. The script can do other things and later callWaitForTablewhen it requires access to the table. Otherwise, i.e. iftimeoutis a positive value, it specifies a timeout in millisecs for opening the table, andOpenTablereturns only when the table is actually open, or the timeout has elapsed, whichever happens first. -
Alias names are compared case insensitively.
-
Call
GetOpenTableNameto find out whether the table has opened.
SelectTableGroup procedure
Selects a table group from the “table group” combo box.
Synopsis
SelectTableGroup("MyTables")
Parameters
|
Name |
Type |
Required? |
Description |
|---|---|---|---|
|
group |
string |
yes |
Table group name, or empty string |
Returns
Nothing.
Remarks
-
The table group name is compared case insensitively.
-
An empty string removes the table group filter.
-
As a result of this operation, the number returned by the
CountTablesfunction may change.
SetTablesFilter procedure
Enters a search string into the tables filter field.
Synopsis
SetTablesFilter("My")
Parameters
|
Name |
Type |
Required? |
Description |
|---|---|---|---|
|
filter |
string |
yes |
Search text or empty string |
Returns
Nothing.
Remarks
-
An empty string removes the search field.
-
As a result of this operation, the number returned by the
CountTablesfunction may change.
WaitForTable procedure
Waits for a table to open.
Synopsis
WaitForTable(LocalTable, 5000)
Parameters
|
Name |
Type |
Required? |
Description |
|---|---|---|---|
|
|
string |
yes |
Table alias name |
|
|
number |
no |
Timeout in millisecs |
Returns
Nothing.
Remarks
-
This procedure is intended to be used in conjunction with
OpenTablewhen specifying no timeout in theOpenTablecall. -
If
timeoutis not specified or is 0 or negative,WaitForTablereturns immediately. Otherwise, i.e. iftimeoutis a positive value, it specifies a timeout in millisecs for opening the table, andWaitForTablereturns only when the table is actually open, or the timeout has elapsed, whichever happens first. -
Alias names are compared case insensitively.
-
Call
GetOpenTableNameto find out whether the table has opened.