Actions: Database

append to value

Appends data to the specified key’s value of a given table.

Argument Description
Target The place to access the records (local or cloud).
RecordID The ID of the specified record (Either a variable or a value).
Key The key whose value will be appended to.
Value The data appended to the selected key’s value.
TableName The table where the specified key is located.
Delimiter An optional space or command separating the appended value.
DelaySend Optional argument to delay the action if the target is ‘cloud’. Use ‘Flush the Cache’ to process delayed transactions.

batch query records

Searches the specified table and returns the records that match the provided queries.

Argument Description
Output The location where the results will go (variable).
TableName The table whose records will be queried.
Query A single or set of queries used to search the table for matching records.
Target The place to access the records (local or cloud).
ResultFormat The format of the query’s result, either a line-delimited list (recordList) or an array containing the records’ data (recordData).

calc update record

Performs one or more calculations on an existing record with the specified key(s), value(s), and operation and updates the record with the results.

Argument Description
DelaySend Optional argument to delay the action if the target is ‘cloud’. Use ‘Flush the Cache’ to process delayed transactions.
Data An array containing key-value pairs where the key belongs to the specified table and the value is the numeric value to be used in the calculation.
Operator The mathematical operator used in the calculation (add, subtract, multiply, divide).
Target The place to update the record (local or cloud).
TableName The table of the record to be updated.
RecordID The ID of the record to be updated.
Output The location where the results will go (variable).

count displayed records

Counts the number of records in a table element or layout element.

Argument Description
Element The table element or layout element whose records will be counted.
Output The location where the results will go (variable or text or field element).

count records

This function counts the number of records (either cloud or local) in a given table.

Argument Description
Output The location where the results will go (variable or element).
TableName The table where the specified records are located.
Target The place to access the records (local or cloud).

create record

Creates a new record in the specified table with the provided array.

Argument Description
Output The location where the created record’s ID will be stored (variable).
TableName The table where the new record will be created.
Data An array containing key-value pairs.
Target The place to create the record (local or cloud).
DelaySend Optional argument to delay the action if the target is ‘cloud’. Use ‘Flush the Cache’ to process delayed transactions.

delete keys

Delete the specified keys from a record’s contents.

Argument Description
TableName The table where the specified records are located.
Keys A selection of keys (fields) used to make a record.
RecordIDs A line delimited list where each line is the cdbRecordID of a record in the specified table. Can use “*” to specify all records.
Target The place to access the records (local or cloud).

delete record

Removes one or more records in a table.

Argument Description
TableName The table whose record(s) will be deleted.
RecordID The recordID(s) of the record(s) to delete in the specified table. Can use “*” to specify all records.
Target The place to access the records (local or cloud).
DelaySend Optional argument to delay the action if the target is ‘cloud’. Use ‘Flush the Cache’ to process delayed transactions.

flush cache

Flushes the cache where cloud actions with a delaySend of ‘true’ are stored.

get result

Get the result of the last CanelaDB call.

Argument Description
WhichResult Select the kind of result you need.

(Boolean) - if ‘completed’ or empty is passed.
(String) - if ‘context’, ‘response’, ‘date’, or ‘log’ is passed.
(Array) - if ‘recent’ is passed.
OutputVariable Which of the results do you want? See dictionary panel for more

get table id

Get and return the ID of the given table name.

Argument Description
TableName The name of the table whose ID you wish to know
Output The location where the results will go (variable or element).

get table keys

Get and return the comma-separated list of the keys.

Argument Description
TableName The name of the table whose keys you wish to know
Output The location where the results will go (variable or element).

list records

Get a line delimited list of all the recordIDs for the specified table.

Argument Description
TableName The table where the specified records are located.
Target The place to access the records (local or cloud).
Keys A selection of keys (fields) used to make a record.
Output The location where the results will go (variable or element).

load table

Load table(s) into memory so they can be accessed by database actions.

Argument Description
TableName The table(s) to be loaded.

look up value

Retrieves the value associated with the specified key for a given record.

Argument Description
Output The location where the results will go (variable or text or field element).
TableName The table where the specified record is located.
RecordID The ID of the specified record (Either a variable or a value).
Key The key whose value will be retrieved.
Target The place to access the records (local or cloud).

merge record

Modifies a record’s key value using comparisons like “is”, “is not”, “is in”, and “is not in”.

Argument Description
Target The place to create the record (local or cloud).
Data An array containing key-value pairs.
RecordID The ID of the record to be modified.
Delimiter The delimiter used to separate data in the record’s key value.
TableName The table where the new record will be created.
Operator The operator used to compare the record’s key value.
DelaySend Optional argument to delay the action if the target is ‘cloud’. Use ‘Flush the Cache’ to process delayed transactions.

ping

Pings the cloud server where the table is located and returns the response time in milliseconds. This action will be processed by the server, so a response indicates that the server is running and is processing requests.

Argument Description
Table The table name or table ID to ping. If a table is not specified, then a table will be chosen at random.
Output The location where the result will go (variable or text element).

ping node

Only compatible with desktop platforms. Calling this action on a mobile platform will return the value ‘N/A’. Pings the cloud server where the table is located and returns the response time in milliseconds. This function is NOT processed by the cloud server, so it only checks if the server is reachable from the client, not if the cloud server is actually running. Ping Node uses shell command ‘ping’. As such, the response will be shorter than the ‘ping’ action response.

Argument Description
Table The table name or table ID to ping. If a table is not specified, then a table will be chosen at random.
Output The location where the result will go (variable or text element).

query records

Searches the specified table and returns the records that match the provided query.

Argument Description
ResultFormat The format of the query’s result, either a line-delimited list (recordList) or an array containing the records’ data (recordData).
Key The key in the table to query on.
Operator The comparison operator for comparing values in the table against the input value.
Target The place to access the records (local or cloud).
TableName The table whose records will be queried.
Value The value to compare the records against.
Output The location where the results will go (variable).

read keys

Read a specific set of records and get only the specified keys for each returned record.

Argument Description
Output The location where the results will go (variable or element).
TableName The table where the specified records are located.
Keys A selection of keys (fields) used to make a record.
RecordIDs A line delimited list where each line is the cdbRecordID of a record in the specified table. Can use “*” to specify all records.
Target The place to access the records (local or cloud).

read record

Reads one or more records in a table.

Argument Description
TableName The table whose record(s) will be read.
RecordIDs A line delimited list where each line is the cdbRecordID of a record in the specified table. Can use “*” to specify all records.
Target The place to access the records (local or cloud).
Output The location where the results will go (variable or element).

sort records

Sorts a list of record IDs based on the specified key, direction, and sort type.

Argument Description
Target The place to access the records (local or cloud).
Key The key to sort records by.
Direction Which direction (ascending or descending) to sort the records by.
RecordIDs A line delimited list where each line is the cdbRecordID of a record in the specified table.
TableName The table whose records will be sorted.
SortType The type of data stored in the key’s value to sort by.
Output The location where the results will go (variable or text or field element).

sum column

Calculates the sum of all the values (default) or values of the specified records (optional) for the specified key of a given table.

Argument Description
Records Optional argument of a variable containing a line-delimited list of record IDs. Can use “*” to specify all records. If this argument isn’t populated, all records in the specified table will be used.
TableName The table where the specified key is located.
Key The key whose values will be summed.
Target The place to access the records (local or cloud).
Output The location where the results will go (variable or text or field element).

sync records

Syncs a list of records in a specified table between local and cloud.

Argument Description
DetectCollisions Whether to compare record versions and avoid overwriting records if the source has a lower version (true) or to ignore record versions and have all source records overwrite target records (false).
Output The location where the collision or sync results will go (variable).
RecordIDs A line delimited list where each line is the cdbRecordID of a record in the specified table. Can use “*” to specify all records.
TableName The table whose records will be synced.
Source The direction of the sync (cloud or local).
AllowDeletes Whether to remove records in the target if they don’t exist in the source (true) or to ignore them (false).

update record

Updates an existing record in the specified table with the provided array.

Argument Description
DelaySend Optional argument to delay the action if the target is ‘cloud’. Use ‘Flush the Cache’ to process delayed transactions.
TableName The table of the record to be updated.
Data An array containing key-value pairs.
RecordID The ID of the record to be updated.
Target The place to update the record (local or cloud).

This chapter was last updated on Thu 7 Mar 2024 16:27:20 GMT