setdatabaseoptions
DATABASE
,
OPTION
,
VALUE

The setdatabaseoptions statement modifies one or more properties of a database.


Parameters

This statement has three parameters:

database – The database that contains the properties you want to modify, or "" for the current database.

option – The type of information you want to modify. See below for descriptions of each option. The option can be specified in either upper or lower case.

value – The new value for this option.


Description

This statement modifies the properties associated with a database. The database must be open.

Note: You can specify multiple option/value pairs in a single setdatabaseoptions statement, like this:

setdatabaseoptions database,option1,value1,option2,value2,option3,value3

Note: The option names listed below are not case sensitive, so for example "AlwaysKeepOpen", "ALWAYSKEEPOPEN" and "alwayskeepopen" will all work exactly the same.

AlwaysKeepOpen

If this option is set to true, the database will not be removed from memory when its last window is closed. Instead it will remain open “secretly”, so that its data and procedures can still be accessed.

setdatabaseoptions "","AlwaysKeepOpen",true()

When this option is enabled there is no way to remove the database from memory except by quitting Panorama (or of course you can set this option to false and then close it).

AngleUnits

Panorama normally performs trigonometry calculations using radians, but you can override this on a database-by-database basis.

setdatabaseoptions "","AngleUnits","degrees"

Once set, any trig calculations performed while this database is active will be performed using the specified angular units (unless overridden with the Degree or Radian statements.

AutoNumber

This option modifies changes the automatically generated number for the next record that will be added to the database. This allows you to generate numbers out of sequence, or to start the sequence at a specific value. This example sets the number to 1001.

setdatabaseoptions "","AutoNumber",1001

Note: You can find out the current autonumber value with the dbinfo( function. This example skips the next 50 numbers:

setdatabaseoptions "","Autonumber",dbinfo("autonumber","")+50

ExcludeFromRecentMenu

If set to true, this database will not be included in the File>Recent menu.

setdatabaseoptions "","ExcludeFromRecentMenu",true()

For example, you might want to do this for an auxilliary database that is secretly opened for lookups but not opened directly.

ExcludeDataSheetFromViewMenu

If set to true, the data sheet will not be included in the View menu when this database is active.

ExcludeFormsFromViewMenu

If set to true, forms will not be included in the View menu when this database is active. (Note that forms can also be individually excluded by using the setformoptions statement, or the View Organizer.

ExcludeProceduresFromViewMenu

If set to true, procedures will not be included in the View menu when this database is active. (Note that procedures can also be individually excluded by using the setprocedureoptions statement, or the View Organizer.

Data Sheet Dimensions

There are four options that allow you to specify the dimensions that will be used the next time the data sheet is opened. The dimensions are specified in points (72 points = 1 inch).

setdatabaseoptions "",
     "DataSheetTopEdge",80,
     "DataSheetLeftEddge",50,
     "DataSheetHeight",450,
     "DataSheetWidth",600

Note: If the data sheet is currently open, changing these values won’t have any effect, since Panorama will retain the values of the actual visible data sheet.

Data Sheet Toolbar

This option allows you to specify whether the tool bar will appear the next time the data sheet is opened. Use "notoolbar" or "nopalette" if you don’t want the toolbar to appear. If you do want it to appear, use "".

setdatabaseoptions "","DataSheetWindowOptions","notoolbar"

Note: If the data sheet is currently open, changing this option won’t have any effect, since Panorama will retain the toolbar status of the actual visible data sheet.

IntegritySeal

This option allows you to enable or disable the Integrity Seal option for this database.

setdatabaseoptions "","IntegritySeal","YES"

See Database Integrity Checks to learn more about this feature.

Preventing Early Loop Aborts

Panorama normally allows loops to be aborted by pressing the SHIFT-COMMAND-ESCAPE keys, or when a maximum allowed timeout is exceeded. You can disable this using this code:

setdatabaseoptions "","PreventEarlyAbort","YES"

See Preventing Endless Loops to learn more.

Related Databases

Usually the Database Options>Relations panel is used to configure related databases (see Relational Database Management), but this configuration can also be set directly with the setdatabaseoptions statement (in fact, the Relations panel uses this statement internally).

To add or modify a related database, use the "link" option. The third parameter must be a dictionary that specifies how the relation works.

setdatabaseoptions "","link",initializedictionary(
    "DATABASE","Prices",
    "SOURCEKEY","SKU",
    "KEY","ItemΩ")

To remove a related database, use the "removelink" option. The third parameter should be the name of the related database to remove.

setdatabaseoptions "","removelink","Prices"

This option can also be used to remove ALL related databases. To do this, specify empty text as the related database name.

setdatabaseoptions "","removelink",""

Each database field can have autojoin and clairvoyance options. These can be set directly with the setfieldproperties statement, and are also set with the link option if the relational specifications specify these options. The link option will only enable these options, it will never disable them (in case they have been set using setfieldproperties.) If you want to explicitly cancel the autojoin and clairvoyance options associated with a related database, use the "removefieldlinks" option.

setdatabaseoptions "","removefieldlinks","Prices"

The removefieldlinks option is a specialized one that you will probably never need to use, but it is used by the Database Options>Relations panel when relations are edited.

Security Settings

The setdatabaseoptions statement can enable and disable the same security settings available in the Database Options dialog – locking to an account, encryption, and authorized roles (in fact the Database Options dialog uses the setdatabaseoptions statement). Of course these options are only available if you are an authorized user, otherwise you’ll get an error. Be careful – if you are not logged on as an administrator it’s possible to get the database into a state that you are not authorized to get it out of!

To lock the database to the current account, use the "locktoaccount" option.

setdatabaseoptions "","locktoaccount",true()

Note: all of the options below require that the database be locked to the account.

To encrypt the database (AES-256 encryption), use the encrypt options:

setdatabaseoptions "","locktoaccount",true(),
    "encryptdata",true(),
    "encryptforms",true(),
    "encryptprocedures",true(),

Roles

There are four possible roles that a database user can have (see Managing Account Roles): Administrator, Developer, User and Anyone. Use the "OpenRole" option to specify which role is required to open the database:

setdatabaseoptions "","OpenRole","Administrator"

Again, be careful! If you are not logged on as administrator, the statement above will make the database innacessible to you!

To specify what role is required to change the design of the database, use the "DesignRole" option.

setdatabaseoptions "","DesignRole","Developer"

Once this is set, only developers and administrators will be able to change the design of this database, which includes adding or removing fields, editing procedures, or, in fact, running the setdatabaseoptions statement.

You can also use the "StandardUIRole" to specify what roles are allowed to use Panorama’s standard menus and tools.

setdatabaseoptions "","StandardUIRole","Developer"

With this setting, only Developers and Administrators will be able to use the tool palette and standard menus. Regular users will only be able to use pre-programmed procedures that have been set up by a developer or admin user.


See Also


History

VersionStatusNotes
10.2UpdatedAdded the excludedatasheetfromviewmenu, excludeformsfromviewmenu, excludeproceduresfromviewmenu, alwayskeepopen and integrityseal options.
10.0NewThis statement is new in this version.