Create configuration
The simple way for creating database configurations is using an OSI script as shown below. One may, however, also run the OptionWizard, which provides a dialog for entering options.
A simple way of defining options is writing an appropriate OSI script. The data source opened has to refer to the database, were the options are to be stored. This is the typical way of predefining options, when no ODABA GUI and tools have not been installed. When an option template has been defined as appropriate enumeration in the resource database, the new configuration will be initialized from the template.
In most cases, auto-initializing options turn out to be a nice feature. Sometimes, however, it is disturbing. In order to ensure, that no options have been creates for the new configuration, one may delete all options for the configuration.
void ODC_Options::CreateConfiguration ( ) {
changeAccessKey('sk_key');
%DEF_CONFIG_TEMPLATE% = 'myTemplate';
// initializes new configuration from myTemplate enumeration
insert('newConfig');
// add additional options on top level
options.insert('APPLICATION_TITLE');
options.value = 'Test application';
options.insert('APPLICATION_TITLE');
options.value = 'Test application';
options.provide('Options'); // locate application options
options.value = 'eabled'; // mark options as acive (must be handles by application
// create or update application option
options.options.provide('MESSAGE_ON_ERROR');
options.options.value = 'true';
save;
}
void ODC_Options::CreateEmptyConfiguration ( ) {
changeAccessKey('sk_key');
%DEF_CONFIG_TEMPLATE% = '';
insert('newConfig');
// just in case that options have been initialized from default configuration
optiond.eraseCollection();
save;
}
When an option schema has been defined by an appropriate enumeration in the resource database, one may use the option wizard or option dialog in an application for setting appropriate options.
Create new configuration created a new configuration with the requested name. When a configuration template has been defined, the configuration will be initialized with the settings from the configuration template,
Save configuration stores the changes made to the database.
Setup configuration from template adds new options defined in the template to the configuration. Existing options are not affected. Options not defined in the configuration template will remain.
Set selected configuration as default configuration will remove the default option from the configuration currently marked as default configuration. The selected configuration is marked as default configuration, instead.
Delete configuration deletes the selected configuration and all its settings.
Hierarchical options have to be referenced within a program by their complete hierarchical name, e.g. Options.GUI.Settings.DockArea .
// accessing option from whithin a program
if ( Option("Options.GUI.Settings.DockArea").isTrue() ) ...
// Accessing options from whithin OSI
if ( %Options.GUI.Settings.DockArea% == "YES" ) ...

