company logo

Create configuration

User configurations may be defined via program or OSI function or by running the OptionWizard , which provides a dialog for entering options.

Setting for the configuration initialization may be defined in an hierarchical enumeration in the resource database. Enumerator name s correspond to option names, the default option value is defined in the enumerator condition . Moreover, each option enumerator may get a description, which will be displayed in the option browser as user hint for option usage. When the option contains sub options, those can be defined as sub-values for the enumerator or as type, which contains the name of another enumeration containing a subset of values. The latter allows reusing definitions for sub-options (e.g. for defining different data sources). When defining sub-values and a type, the option list will contain the generated options from the sub-values and those derived from the type enumeration.

In order to apply the option schema defined as enumeration, one has to be set the enumeration name as option value for the option DEF_CONFIG_TEMPLATE . The default value is _OptODE . When no or an invalid configuration name has been defined, a new configuration will be initialized from the one, which has been marked as default configuration.

Setting options via OSI script

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;

}

Using Configuration Wizard

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" ) ...

Notes:

One may also use the option wizard for setting options without having an option schema, but in this case, no option description will be displayed in the wizard. Thus, only developers or experienced users should run the option wizard for ad-hoc initialization.