![]() |
![]() |
What is the query syntax?
Each query expression that is evaluated should yield a result object of any of the supported query items.
Here are some sample query expressions:
Each operand in the expression is an object even the constants such as 1
or 'Hello'
. For constants, the data type is determined automatically. Each object can have its own set of methods and properties. To call a method of an object, the following syntax is used:
Methods that do not require any parameters can be called without using the parentheses. Both of the following expressions are valid:
The preceding expressions evaluate to a numeric value of 5, the length of the string 'world'
.
How can repetition in expressions be reduced?
In many cases, various properties of the same object must be inspected in an expression. To reduce expression repetition, a special expression can be used to reference methods of the same class repeatedly. A special construct with square brackets ( []
) can be used for this:
For example, if the current object is a shape with the fill property, and you want to evaluate several fill properties of the current shape, the following expression can be used:
The preceding expression is equivalent to the following:
The following example returns TESTtest:
What are the supported query operators?
You can include the following operators in your queries:
As in most programming languages, operators have certain precedence:
Consider the following example:
In the preceding example, multiplication is performed first and addition second (because the multiplication operator [ *
] has a higher precedence than the addition operator [ +
]).
Parentheses ( ()
) can be used to modify the precedence, as in the following example:
![]() |
![]() |
![]() |
Copyright 2007 Corel Corporation. All rights reserved.