View properties
From a view source, any number of view properties can be derived. View properties can be defined in a view schema, which can be referenced in the USE operation:
- Persons().USE('PView')
- where the view schema ( PView ) applies on all instances in the view source. Thus, USE replaces the SELECT clause in an OSI query. The SELECT clause is another way of defining view properties in an ad hoc query:
- Persons().DEFINE(name, address, full_name = getFullName)
- View properties might be simple attributes, complex data type instances or collections. When not passing a calculation rule, the rule property is taken as being defined under the same property name in the source. One may also pass calculation expressions as operands, expressions, or expression calls defined in the context of the view source instances.
- In case, the view source is untyped or weak-typed, view property definitions must be valid for all instance types, which may appear in the view source. One way of ensuring view property compatibility is calculating critical properties via virtual expressions.
// osi example with inline expression
Person::Persons.Select( pid, address,
STRING full_name = {
VARIABLES
STRING result;
PROCESS
result = (sex == 'male' ? 'Mr. ' : 'Mrs. ');
result = result + first_name + ' ' + name;
return(result);
};