ReportsAnywhere uses the Object Query Language as defined by the ODMG standardisation
organisation.
An ReportsAnywhere filter or formula is an OQL predicate. A predicate is the where part of an OQL query.
A general OQL query has the form:
select this from
that where predicate
In ReportsAnywhere the variable name of the outermost scope can be written as this and the type of this is either
the element type of the collection to which the predicate is applied to or
the type of the single object where the predicate is evaluated.
Example:
Assume there is a collection of Students, that you want to report on. To select all students whose name
starts with a you would write:
name like "a*"
This is equivalent to the general OQL query:
select * from Students this where name like "a*"
ReportsAnywhere implements a subset of OQL. The parts of OQL that are specified interactively in ReportsAnywhere such as
aggregation, sorting, grouping, and structure building have been omitted. For the
semantics of the grammar rules below please see the ODMG standard which is available through the
ODMG
The OQL implementation of ReportsAnywhere provides a number of
standard
functions that can be
used within predicates or formulas.
Here is an overview of the OQL predicate syntax as implemented by ReportsAnywhere:
- Basic
query ::=nil | true | false | this | env
query
::=integer | float | character | string
query ::=(query)
- Simple Expression (see 4.9.5)
query ::=query + query
query ::=query - query
query ::=query *
query
query ::=query / query
query ::=- query
query ::=query mod query
query ::=abs (query)
query ::=query || query // string concatenation also written as +
- Comparison Expression
query ::=query comparison_operator query
query ::=query like string_literal
comparison_operator ::==
comparison_operator ::=!=
comparison_operator ::=>
comparison_operator ::=<
comparison_operator ::=>=
comparison_operator ::=<=
- Boolean Expression
query ::=not query
query ::=query and query
query
::=query or query
- Access Expression
query ::=query dot attribute_name
query ::=query dot operation_name(query {,query}) //
not implemented
dot ::=. | ->
query ::=* query // not implemented
query ::=query [query]
query ::=query [query:query] //sub list
query ::=query [query .. query] //sub
list
query ::=first (query)
query ::=last
(query)
query ::=function_name([query {,query}]) // implemented for a number of
predefined functions
- Collection Expression
query ::=for all identifier in query: query
query ::=exists identifier in query: query
query ::=exists(query) // not implemented
query ::=unique(query) // not implemented
query ::=query in
query // not implemented
query ::=query comparison_operator quantifier query //
not implemented
quantifier ::= some | any | all
query ::=count (query)
query ::=count ( * )
// not implemented
query ::=sum (query) // not implemented
query
::=min (query) // not implemented
query ::=max (query) // not implemented
query ::=avg (query) // not
implemented
- Select Expression // not implemented
There is a non standard short hand notation for a nested select
expression:
filter identifier in query: query
This is equivalent to;
select * from query identifier where
query
- Set Expression
query ::=query intersect query // also written as query * query
query
::=query union query // also written as query + query
query
::=query except query // also written as query / query
- Conversion Expression
query ::=listtoset (query) // not implemented
query ::=element (query) // not
implemented
query ::=distinct(e) // not implemented
query ::=flatten (query)
// not implemented
query ::=(class_name) query
Related topics: