Data Access and Manipulation

new record for &path

Returns a new, empty record instance that is ready to be inserted into the specified path in the database.

record ( field = value, field = value, ... ) for &path

Constructs a new record that is ready to be inserted into the specified path in the database. The field and value pairs indicate the field values to set in the record. A value can also be a 'record' statement to construct a hierarchical record structure. When a record is nested within a value, it is not necessary to specify the 'for' suffix.

record ( Field=value, ... )

Construct a new record, that is not tied to a specific location in the database.

new list for &path

Returns a new list instance that is ready to be inserted into the specified path.

add x to y

Adds the record (or item) x to the list (variable), y.

remove x from y

Removes the record (or item) x from the list (variable), y.

load (&path)

Loads the specified path in the database, and returns a list containing that data.

load (&path with [fieldlist]; [sortlist]; [top]; [files]; [range]; [links]; [deep]; [no checks])

A load statement with more options, as defined below:

fieldlist : fields ( field1, field2 [count | total | average | file] )

Defines the list of fields to retrieve. An optional aggregate function is specified after the field name.

sortlist : sort (field1 ascending, field2 descending )

Defines the sort criterion to use when retrieving data. Multiple fields can be specified, and each field can be sorted ascending or descending.

top: top 4

Retrieves the top 4 (or any number) records from the database, based on either the default or specified sort criteria.

files : files

Retrieves any file data in the record.

deep

Retrieves all child records as well as the specified record. Use with caution as this may download a lot of data.

cache

Loads the data from the in-memory cache if it's available, otherwise loads it from disk and stores it in the cache for the next retrieval. If only "cache" is specified, then the cache will exist only for the transaction. If a number is specified afterwards, it will cache that data globally for that many minutes.

lock none | exclusive | page

Retrieves the data with holding a specific lock. Defaults to row-lock if none specified. Exclusive means that the lock is held exclusively and cannot be shared with any other loads at that time. None means that no locks are held, and you may read data that is not yet committed. Page means that the whole page of rows will be locked, not just the rows being requested.

range: range 1 to 10

Retrieves only the records of the range 1 to 10 (or any specified range).

await: await 30

Waits for the data at the path to update, or timeout n (30) seconds, and then returns the current data.

no checks

Loads data without checking that records at the specified path actually exist. If this is not specified, an error will be displayed if no records match the given path.

links : links from &foreignLinkField

Retrieves back links. Retrieves records throughout the database that point to the specified load path. Retrieves only those records that have the field specified in the path 'foreignLinkField' pointing to this record.

Note : Only the path of the nodes is retrieved. You can access this using the PathOfRecord function. You must then load the actual data using another load statement.

load (all Type below Path)

Returns a list of all records of the type specified in Type (which can be a type name, in double quotes, or a path to a record of the same type), that are below the specified XPath. If an XPath is specified for the type, then a predicate can also be added to the end of the path to filter the result.

save [all] #variable

Saves any changes made to the variable, which must be previously loaded from the database. Optionally saves all of the data in the record again (if 'all' is specified), otherwise just saves the changes that were made.

insert [new] #variable at &path

Inserts the specified record or list (held in #variable) into the database at the location specified by path.

If the optional 'new' is specified, changes the IDs of the record, effectively duplicating it if it's already in the database.

insert #variable into #list

Inserts the specified record or list into the existing list variable specified in #list. Only affects the list in memory, not in the database.

delete at &path

Deletes the record(s) from the database at the path specified.

Note: All child records are also deleted, there is no confirmation, and no way to undo the delete. Use with caution!

remove #variable from #list

Removes the specified record (in variable) from the specified list, that is stored in memory.

Item(sequence, index)

Returns the Nth (index) record in the given sequence list.

sync path1 with path2 linking field1 and field2 (new as #new, deleted as #deleted, updated as #updated)

Synchronizes two parts of the database, as specified in path1 and path2, using the values in field1 of path1 and field2 of path2 to link the records.

Any records that are missing from path2 will be placed into a list called #new. Any records that are missing from path1 will be placed into a list called #deleted, and any records that are different will be placed into a list called #updated.

The synchronization operation performs no changes to the database. Rather, the records in the lists should be inserted, saved or deleted to apply the synchronization changes.

The modified dates in the records are utilized to determine whether a record has been updated.

Top(sequence, count)

For a sequence object, returns only the top 'count' number of records in that list.

Sort(sequence, field, ascending)

Sorts the given sequence object by the specified field. If ascending parameter is 'false' then the list will be sorted by descending values.

NewList()

Returns a new, empty sequence.

NewRecord()

Returns a new, empty record.

Next Topic: Functions


Please post all questions on the support forum. Thank you.