company logo

select method

The select method allows creating new instances from the instances passed from the preceding property path. The parameters passed to the select operation define the properties of the result instances. The select method is a generic class method, which provides exactly one instance for each instance passed to the operation. New properties can be computed by means of expressions, which must be valid expressions in the context of the instance passed to the select method, i.e. the expressions may refer to any property defined in the instance passed to the method.

By defining the target type the select statement can also alter the type of the computed result (e.g. text instead of numerical value).

Person.select(name, string(3) age: Date().year() - birthday.year())

will return the name and the age as string for all persons in the Person extent.

Generalisations:  OQL method
Referenced in