source - Property source
A property source may be defined when the member is a view property or marked as transient. Other sources may be defined for data exchange (mapping schema), aggregation rules (aggregation schema) or other purposes. Selecting proper source definition depends on the source name.
Data sources are often identified by name, depending on the type of usage. The path or expression defined for the data source also depends on type of usage, i.e. in some cases it must be defined in the context of the current data type, in other cases in the context of the source data type.
Typically, data sources are defined for transient properties. For transient properties, the source having the same name as the property is considered as rule for evaluating the property value. When no such source could be located, the first data source is considered as evaluation rule for transient property.
When no data source is defined for a transient property, the property remains empty until it is filled by application.
Sources for data exchange properties are defined in data types for external files. External files may be accessed via property handle, but one may also import external files by providing import/export schemata. A data exchange schema is is defined by all source definitions with the same source name. In case of simple data exchange (no schema), the first data source defined for a property is used (compatibility with previous versions).
Data exchange sources are referenced when calling loadData() or storeData() functions, which may obtain an exchange schema name. When no exchange schema name has been passed, the first defined data source is used. When passing an exchange schema name, the source definition with the passed schema name is used. When no exchange data source could be located (first or by name), the property is excluded from data exchange.
Source definitions for data exchange (Path/Expression) may be defined in different ways:
- Property path - The source is an access path valid in the context of the applied database data type (target for import and source for export).
- Expression - expressions must be enclosed in {...} . or an expression (in case of import). Expressions must be valid in the context of the applied database data type
- Constant - the source may also contain a constant value (string or number).
- Empty - an empty path in a source definition means, the current data source is used (the parent in hierarchical data exchange).
- '*' - as data source means that a property with the same name is used for data exchange (same as no data source for data exchange without schema).
Transient properties may be defined in external file data types, but those are not included in export or import. Source definitions in transient properties must be defined in the scope of the current data type.
When not using an exchange schema name (source name in property definition), properties are copied using the first source definition . When no data source is defined in this case, property handle is searched by name, i.e. also property handles without source are copied, which is not the case when using a schema name.
Excluded from copy in a simple exchange are all properties, that are transient, because those are later when being accessed.
Data sources for view properties may be defined for grouping attributes or for properties to be selected (SELECT), but also for the view source, when this is different from the calling object (object instance calling the view).
For view properties the source having the same name as the property or the first source definition in the list (when not found) is considered as rule for evaluating the property.
Data sources for FROM clause must be defined globally or in the context of the class that defines the view method. Sources for grouping attributes must be defined in the context of the data type returned from the FROM clause. Sources for properties defined transient in the grouping definition must be valid paths or expressions in the context of the GROUP data type. Source definitions for SELECT properties must be valid in the context of the GROUP data type. Sources for transient SELECT properties must be valid in the context of the SELECT type.