Property :: executeExpression - Execute expression
Execute expression allows running in line expressions or predefined expressions. When running an in line expression containing one or more statements, the expression must be enclosed in {...}. The result is returned as property handle, which enables an expression returning elementary or complex instances as well as instance collections.
Inline expressions may include calls to predefined expressions stored in the resource database or loaded from an expression file. Property and expression or function references used within an expression must be valid within the scope defined by the data type of the property handle.
Since changing instance selection in the property usually influences the expression result, expressions must be reevaluated after selecting another instance in the property handle. In order to avoid analyzing the inline expression each time when calling it, complex OSI functions should be defined in the resource database or in an external OSI library directory ( Dictionary ::loadLibraries() ).
When the expression or function definition is invalid, or when an error has been detected executing the function or expression, an exception will be thrown.
"if (1 > 2) Print('true')" // in line expression
"GetTotalIncome(2004)" // predefined OSI function
"{ VARIABLES // inline OSI function
int total;
PROCESS
while ( children.next() )
total += children.income;
return total; }
A property handle refers to a (usually) opened property. Invalid properties may cause an exception.
Implementation overview
- Execute expression for property
Property :: executeExpression ( vExpression ) - Run OSI functions from specific resource database
Property :: executeExpression ( cResourceObjectSpace, vExpression, bServer ) - Execute expression on server
Property :: executeExpression ( vExpression, bServer )
Implementation details
-
Execute expression for property
odaba::Property Property  :: executeExpression ( odaba::String &vExpression )
The function executes an expression passed in vExpression in the scope of the selected instance in the property handle. OSI functions called from within the expression are looked for in the dictionary of the property handle ( dictionary() ). By default, the function will be executed locally.
- vExpression
- OSI inline expression
An inline expression can be passed as operation path, as operand (something like a + b) or as complete expression. As operand, an expression may contain any expression, which is allowed in a statement, but no semicolon must be appended at the end.
Complete expressions include expression header (optional) and may include different sections in the expression body which is enclosed in { ... }.
In contrast to class expressions, inline expressions are not defined explicitly as class expressions but passed as strings to the application at run-time.
In order to pass no expression, an empty string ( String() ) has to be passed.
to list
- vExpression
- OSI inline expression
-
Run OSI functions from specific resource database
odaba::Property Property  :: executeExpression ( odaba::ObjectSpace &cResourceObjectSpace, odaba::String &vExpression, bool bServer )
The function executes an expression passed in vExpression in the scope of the selected instance in the property handle. Referenced OSI functions called from within the expression are looked for in the object space passed in rResourceObjectSpace .
- cResourceObjectSpace
- Reference to resource object space
The resource object space handle usually is a database handle, which is referred to as object space handle.
- vExpression
- OSI inline expression
An inline expression can be passed as operation path, as operand (something like a + b) or as complete expression. As operand, an expression may contain any expression, which is allowed in a statement, but no semicolon must be appended at the end.
Complete expressions include expression header (optional) and may include different sections in the expression body which is enclosed in { ... }.
In contrast to class expressions, inline expressions are not defined explicitly as class expressions but passed as strings to the application at run-time.
In order to pass no expression, an empty string ( String() ) has to be passed.
- bServer - Server option
to list
- cResourceObjectSpace
- Reference to resource object space
-
Execute expression on server
odaba::Property Property  :: executeExpression ( odaba::String &vExpression, bool bServer )
The function executes an expression passed in vExpression in the scope of the selected instance in the property handle. OSI functions called from within the expression are looked for in the dictionary of the property handle ( dictionary() ). In order to pass execution of the function or expression to the server, true has to be passed in bServer .
- vExpression
- OSI inline expression
An inline expression can be passed as operation path, as operand (something like a + b) or as complete expression. As operand, an expression may contain any expression, which is allowed in a statement, but no semicolon must be appended at the end.
Complete expressions include expression header (optional) and may include different sections in the expression body which is enclosed in { ... }.
In contrast to class expressions, inline expressions are not defined explicitly as class expressions but passed as strings to the application at run-time.
In order to pass no expression, an empty string ( String() ) has to be passed.
- bServer - Server option
to list
- vExpression
- OSI inline expression