[JOIN] propertyId(expr1, ..., exprN)
[JOIN] "[" operator "]" (expr1, ..., exprN)
[JOIN] "[" expression "]" (expr1, ..., exprN)
"]" are ordinary brackets.
JOIN operator creates a property that implements a composition of properties. The main property can be defined by one of the three following options:
- an ID of the existing property
- a context independent property operator enclosed in brackets.
- an expression enclosed in brackets.
The latter two options allow to use as the main property a property without a name which is created right at the place of use. In certain cases, this can make the code more concise and avoids the explicit declaration of an intermediate property using the
= statement that will not be used anywhere else. An operator or expression enclosed in brackets with an equal sign can use external parameters if necessary. When determining the parameters of the created "anonymous" property, the same rules apply as when creating the property in the
= statement, in the case when the parameters are not defined explicitly.
JOIN operator is also responsible for such constructions as
propertyID(a, b), i.e. just an existing property with the parameters passed to it. In such cases, when possible, the
JOIN operator will not create a new anonymous property but return the property with the
expr1, ..., exprN
A list of expressions defining the arguments of the main property. The number of expressions should be equal to the number of parameters of the main property.
A context-independent property operator that is used to create the main property.
An expression which is used to define the main property. Cannot be a single parameter.
f = DATA INTEGER (INTEGER, INTEGER, INTEGER);
g = DATA INTEGER (INTEGER, INTEGER);
h = DATA INTEGER (INTEGER, INTEGER);
c(a, b) = f(g(a, b), h(b, 3), a);
count = DATA BPSTRING (INTEGER);
name = DATA BPSTRING (INTEGER);
formatted(INTEGER a, INTEGER b) = [FORMULA BPSTRING ' CAST($1 AS TEXT) || \' / \' || CAST($2 AS TEXT)'](count(a), name(b));
Sometimes it’s convenient to define the main property with an expression to simplify the source code and make it more understandable.
cathetus1 = DATA DOUBLE(Triangle);
cathetus2 = DATA DOUBLE(Triangle);
hypotenuseSq(triangle) = cathetus1(triangle)*cathetus1(triangle) + cathetus2(triangle)*cathetus2(triangle);
// a similar property set using composition
hypotenuseSq2(triangle) = [ x*x + y*y](cathetus1(triangle), cathetus2(triangle));