Mobile Data StudioObject Model › Database

The Database class is the session database for a Project, storing potentially many Session objects.

Unlike other collection classes, the Session objects do not actually exist in memory until they are loaded on demand from the database. This load action is transparent.

This can be obtained via the Project.Database property.

Enumerable

This class can be enumerated with a For Each loop.

Each enumerated item is a Session.

Indexable

This class can be indexed, with either an Integer or a String index:

  • An Integer index must be between 1 and the Count property.
  • A String index is a GUID of the session to load (see Session.GUID).

Returns the matching Session, or nothing.

Properties

Application

Returns the root Application.

Count

Returns the number of sessions stored in the database as an Integer.

Project

Returns the Project this database belongs to.

Methods

Add

Returns a new, empty Session object.

Takes no parameters.

IsFileValue

Utility function for dealing with files embedded as Variant values, as commonly used in session data for points like Camera. This function checks a Variant value to see if it contains an embedded file.

Takes one parameter:

  • value - a Variant value that may or may not contain an embedded file.

Returns True if value contains a file, or False if not.

GetFileName

Utility function for dealing with files embedded as Variant values, as commonly used in session data for points like Camera. This function inspects a Variant value and gets the original filename of the file embedded within it.

Takes two parameters:

  • value - a Variant value that contains an embedded file.

Returns a String with the original filename of the embedded file.

LoadFromFile

Utility function for dealing with files embedded as Variant values, as commonly used in session data for points like Camera. This function loads a file from the local filesystem and creates a Variant with the file data and filename embedded inside.

Takes one parameter:

  • fileName - a String with the path of a file to embed in a Variant.

Returns a Variant value with the file data and its original filename embedded. This can then be added to a Session, etc.

SaveToFile

Utility function for dealing with files embedded as Variant values, as commonly used in session data in points like Camera. This function extracts a file embedded in a Variant value and saves it to disk.

Takes two parameters:

  • value - a Variant value that contains an embedded file.
  • fileName - a String that contains the path to save the embedded file to.