company logo

Data source definition

Several types of data sources may be defined depending on the value selected in Data Reference Type.

Relative data source

Most data source definitions refer to relative data sources. i.e referring to class properties or related properties. In order to refer to class properties, the reference_type type has to DRT_PropertyPath or property path. The data_reference contains the property or access path, which is either a class property name or a path beginning with a class property name.

Inherit data source

Inheriting data sources means to share the data source with the parent element (control). In order to inherit from the parent element, the data reference type (reference_type) has to be set to DRT_PropertyPath or property path and the data source (data_reference) should be set to '*'.

When inheriting data source prom parent control, data source properties are usually taken from the data source definition of the parent control. Properties as Base Collection, Order Key, Class Name or Filter cannot be redefined for *-data sources. The only properties, that can be overwritten in *-data sources are Access Mode, Collection and Use Copy.

When Use Copy is on, a cursor copy will be created and properties set for the current data source will replace parent data source properties..

Notes:

When inheriting data source,

Global data source

Global data sources refer to an extent or extent path (access or operation path) in data_reference. Global data sources are, typically, defined for global actions, but might be defined also in the context of local field within a control. For defining global data sources, the data reference type (reference_type) has to be set to DRT_Extent or extent.

Transient data source

Transient data sources are typically used in order to display dialogs. there are different ways for defining transient data sources.

Complex data type

For defining a transient data source referring to a complex the data type, the data reference type (reference_type) has to be set to DRT_UserDefined or user-defined and the complex data type has to be defined as structure name (structure_name). In order to create and initialize a data instance, auto-initialize (auto_init) has to be set, in addition. Usually, the data source reference (data_reference) remains empty.

When opening a control referring to such a transient data source, an initialized transient instance will be created and can be updated by the user. Transient instances should not contain references.

Application controlled data source

For defining an application controlled data source, the data reference type (reference_type) has to be set to DRT_UserDefined or user-defined and the expected complex data type has to be defined in structure name (structure_name). The auto-initialize (auto_init) has to be switched off. Usually, the data source reference (data_reference) remains empty.

While running the application, the data source may be updated from the application (context class) by calling ControlContext::setProperty().

Notes:

Do never define data source inheritance (data_reference = *) for application controlled data sources, since this may damage the data source origin when setting the data source for the control.

Option value data source

When requesting parameters from a user within an application in order to execute a certain task, parameter values are typically defined as controls based on option values. Since option values can be initialized easily at run-time and can also be easily accessed after calling the dialog, this provides a simple way of getting user-defined parameters.

For defining option data sources, the data reference type (reference_type) has to be set to DRT_Option or option The name of the option variable has to be defined in data_reference (without enclosing %).

Display constant value

In order to initialize the data source with a constant value, which might be updated later on in the application, one may define a user defined data source by setting reference_type to DRT_UserDefined or user-defined with data type (structure_name) STRING and auto-initialization (auto_init = true). The value passed in data_reference will be set as initial value in the data source string instance.

Application data source

In order to refer to the data source of another control in the application, a field path might be defined instead of a property path in data_reference by selecting DRT_FieldPath or field path from the drop list.. The field path describes a hierarchical field reference by means of field (not control) names in a control hierarchy. The field path might be preceded by one or more dots '.' for addressing parent controls relative to the current control.

// current control: name (in Prson control)

.address.street // street line edit in an address subcontrol

.first_name     // first name in person window

// addressing the same from within the person control

address.street

first name

Enumeration data source

In order to display enumerations, the data source reference type (reference_type) has to be set to DRT_Enumerationor enumeration The property path (data_reference) contains the enumeration name, in this case. Enumerations have to be defined in the dictionary (resource database).

Metadata extent

One may also refer to metadata (data stored in the resource database) in order to refer to selection conditions (filter) or other metadata sources.

For defining metadata sources, the data reference type (reference_type) has to be set to DRT_ResExtent or resource extent The property path (data_reference) contains the extent name or an operation path.

Related topics