Functions for Tables
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
name
is set to "*current",FIndTable
searches for the currently selected table (if any).If the search doesn’t find a matching table,
FindTable
returns -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
timeout
is not specified or is 0 or negative,OpenTable
returns immediately. The script can do other things and later callWaitForTable
when it requires access to the table. Otherwise, i.e. iftimeout
is a positive value, it specifies a timeout in millisecs for opening the table, andOpenTable
returns only when the table is actually open, or the timeout has elapsed, whichever happens first.Alias names are compared case insensitively.
Call
GetOpenTableName
to 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
CountTables
function 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
CountTables
function 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
OpenTable
when specifying no timeout in theOpenTable
call.If
timeout
is not specified or is 0 or negative,WaitForTable
returns immediately. Otherwise, i.e. iftimeout
is a positive value, it specifies a timeout in millisecs for opening the table, andWaitForTable
returns only when the table is actually open, or the timeout has elapsed, whichever happens first.Alias names are compared case insensitively.
Call
GetOpenTableName
to find out whether the table has opened.