dbinfo(
OPTION
,
DATABASE
,
EXTRA
)

The dbinfo( function gets information about a database: what forms it contains, what fields, what flash art pictures, etc.


Parameters

This function has three parameters:

option – controls what kind of information this function will retrieve.

database – is the name of the database you want to get information about. This must be a database that is currently open. If you want to get information about the current database you can use the info(“databasename”) function or simply use empty text ("").

extra – some dbinfo( options require an additional parameter. For example the link option requires an extra parameter specifying the related database name. Unless otherwise specified in the description below, the extra parameter should be omitted.


Description

The dbinfo( function gets information about a database: what forms it contains, what fields, what flash art pictures, etc. This function returns a text array, number or binary data, depending on the option selected.

The “all” option returns a dictionary containing all of the items below (except for items that return binary data, like fieldtypes). You can also get this dictionary by omitting the option parameter, like this:

dbinfo("somedatabase")

If you omit both parameters the function will return the dictionary for the current database.

dbinfo()

Of course to display the returned dictionary you would need to use the dumpdictionary( function.

displaydata dumpdictionary(dbinfo())

The “alwayskeepopen” option returns true if the database will be kept open in memory even if all its windows have been closed. This option can be enabled with the Database Options>General panel or with the setdatabaseoptions statement.

The “angleunits” option returns the name of the current angle units setting for the specified database, either radians or degrees. (You can change this setting with the setdatabaseoptions statement.

The “crosstabs” option produces a text array (with carriage return separators) containing a list of the crosstabs in the database.

The “databytes” option returns the number of bytes used by the data in this database.

The “datacorruption” option checks the data structure for corruption. If there is not corruption, this function returns empty text (""). If corruption is detected, a description of the corruption is returned. See Database Integrity Checks.

The “datasheetleftedge”, “datasheettopedge”, “datasheetrightedge” and “datasheetbottomedge” options return the dimensions of the data sheet window (whether it is currently open or not). The “datasheetrectangle” function returns a rectangle with all four coordinates in binary form.

The “datasheetoptions” option returns the data sheet window options, for example notoolbar if the toolbar is disabled.

The “fieldcount” option returns the number of fields in this database.

The “fieldnumber” option returns the number of the currently active field in this database (starting from 1). If the database has more than one window open, this function will return the active field in the window that was most recently in front.

The “fields” option produces a text array (with carriage return separators) containing a list of the fields in the database. (If a field name contains carriage returns, they are converted to spaces before being placed into the array.) There are also several variations that return only a subset of fields – “lineitemfields”, “visiblefields”, “hiddenfields”, “textfields” (which also includes choice fields), “integerfields”, “floatfields”, “numericfields” (returns both integer and float fields), “datefields”, “binaryfields” and “nonbinaryfields”.

The “fieldtypes” option returns a binary array with one byte per field. Each byte indicates the type of the corresponding field:

0 ☞ text
4 ☞ date
5 ☞ floating point number
6 ☞ integer
11 ☞ binary

The “filevariables” option produces a text array (with carriage return separators) containing a list of the fileglobal variables associated with the database.

The “flash art” option produces a text array (with carriage return separators) containing a list of the flash art in the database’s Flash Art gallery. Since Panorama X doesn’t support the Flash Art gallery feature, this will always return empty text.

The “folder” option returns the folder path to the database (the location of the database file on the disk, see Files and Folders.).

The “forms” option produces a text array (with carriage return separators) containing a list of the forms in the database.

The “integrityseal” option returns true if the database will include an integrity seal when saved. See Database Integrity Checks.

The “library” option returns true if this database is a library, false for regular databases.

The “lineitemroots” option returns a list of the repeating fields in a database (line item fields). Only the roots of each repeating field is included, not the numeric suffix. For example if the database contains fields Qty1, Item1, Price1, Qty2, Item2, Price2, … Qty12, Item12, Price12 then this function would return:

Qty
Item
Price

If you need a list of all line item fields, including the numeric suffixes, use the “lineitemfields” option.

Note that not all fields with a numeric suffix are considered line item fields. Line number fields must be in a sequence starting with 1. If the sequence doesn’t start with 1, the fields will not be considered line item fields. For example, the fields Year2017, Year2018, Year2019, Year2020 will not be considered line item fields unless there is also a Year1 field.

The “links” option returns a carriage return separated list of all of the databases that are relationally linked to this database (see Relational Database Management).

The “link” option returns the specification dictionary for an individual relational link (use the links option to get a list of all relations for this database). This example finds out the key field for the Prices database that is linked to the the current database.

let priceRelation = dbinfo("link","","Prices")
let priceKey = getdictionaryvalue(priceRelation,"SOURCEKEY")

As you can see, this option requires a third parameter to the dbinfo( function, the name of the related database.

The “lockstatus” option returns the status of the last attempt made to lock a record. This can be used with the lockcurrentrecord( function to find out the reason why a record could not be locked. The possible results are:

The “lockmessage” option returns detail information about the last attempt made to lock a record. This can be used with the lockcurrentrecord( function to find out the reason why a record could not be locked. For example if the record is locked by another user, this message will include that user’s name and their computer name.

The “maxsummarylevel” option returns the level of the highest summary level in the database, a number from 0 to 7. If there are no summary records, the result will be zero.

The “permanent” option produces a text array (with carriage return separators) containing a list of the permanent variables associated with this database. However, the permanent variables will not be listed if the database is in user or custom mode (the database must be in author mode).

The “preventearlyabort” option allows you to determine whether loops can be aborted by pressing the SHIFT-COMMAND-ESCAPE keys, or when a maximum allowed timeout is exceeded. The function will return true if loops can be aborted or false if they cannot. See Preventing Endless Loops to learn more.

The “procedures” option produces a text array (with carriage return separators) containing a list of the procedures in the database.

The “records” option returns an integer value – the total number of records in the database.

The “selected” option returns an integer value – the number of currently selected records in the database.

The “summarylevels” option produces a two dimensional text array with detailed information about the summary records in the database. Each line contains information about a summary level (the first line is for data records, the second for first level summaries, etc.). Each line contains three values separated by tabs. The first value is the name of the field that corresponds to this summary level, if any (in other words, the field that this level was grouped by). The second value is the overall number of records at this summary level, and the third value is the number of visible records at this summary level.

The “savedwindows” option produces a list of windows that were open the last time the database was saved. Form windows are prefixed by FORM:, procedure windows are prefixed by PROCEDURE:.

The “lasttimewindowinfront” option returns a superdate value (combined date and time) that indicates the last time the data sheet in this database was the active window.

Client/Server Options

The following options apply to shared and web published databases.

The “shared” option returns true if the database is currently shared, or false if it is not.

The “host” option returns the name of the server this database is hosted on.

The “connected” option returns true if the database is currently connected to the server, or false if it is not (for example if it is a single user database, or if it is shared but Panorama failed to make a connection to the server when it opened).

The “connecterror” option normally returns empty text (""). However, if there was an error in attampting to connect this database to the server, this option will return the error message.

The “serverdatabasename” option returns the name of this database on the server, which may be different than the name on the local client.

The “serverdatabaseid” option returns a unique identifier for this database on the server. This value will change each time a new sharing generation is uploaded to the server.

The “serverdatabaseidhistory” option returns the history of all the generations of this database on the server. The format of the text returned by this option is undocumented.

The “recordlockid” option returns the id of the record currently locked by this client, or zero if no record is locked.

The “autounlock” option returns true if this database is configured to automatically unlock the current record after a specified delay (see the next option). If automatic unlocking is disabled, this option returns false.

The “autounlockduration” option returns how much inactivity is allowed (in seconds) before changes in the current record are sent to the server and the record is unlocked. This value has no effect if the previous option is false.

The “webpublish” option returns true if web publishing is enabled for this database.

The “webstartopen” option returns true if the server automatically opens this database when the server launches.

The “webautoopen” option returns true if the server automatically opens this database on the server each time it is accessed by a web browser.

The “webautoclose” option returns true if the server automatically closes this database on the server after each time it is accessed by a web browser.

The “webautosave” option returns true if the server automatically saves changes to this database after each time it is accessed by a web browser.


See Also


History

VersionStatusNotes
10.2UpdatedAdded the new lockmessage option, and over a dozen new client/server options. Also added the alwayskeepopen, datacorruption, integrityseal, lineitemfields and lineitemroots options.
10.0UpdatedCarried over from Panorama 6.0, but with numerous new options.