6.5

© 2007 ABBYY. All rights reserved.
51
7. Like is string comparison operation,
8.
In is occurrence indicator: the dimension of the result is the dimension of the first operand. Each result element is True if the
respective element of the first operand is present in the second one; otherwise the result is False.
Examples.
{`My`,`Your`} & {` name`,` age`} is {`My name`,`Your age`}
{2,–1} In {3,5,1,2} is {True, False}.
{`F`,`F`, `aBBBa`, `aM5b`} Like {`[A–Z]`,`[!A–Z]`,`a*a`,`a[L–P]#[!c–e]`} is {True, False, True, True}
Binary operators priority
As any expression can contain several binary operators (for example, 3+4*5), the calculation priority for the operators must be
defined. Of course, if a subexpression is enclosed in brackets, it is calculated first. The following is the list of operators in order of
calculation. Operators of the same priority are calculated in order of appearance:
1. ^,
2. / , *,
3. + , –,
4. &,
5. Like,
6. In,
7. , < , <= , >=,
8. = , <>,
9. Or , And.
Unary operators: – , !
Syntax. <MR>::= ( … | <Unary operator> <MR1> | … )
<Unary operator>::= ( – | !)
Meaning.
Before the operation begins, the MR1 operand is converted to the following type:
· Real for the “–” operation,
· Boolean for the “!” operation.
The required operation is performed element by element, so that the dimension of the result is the same as the operand’s.
1. “–“ – arithmetical operation of multiplication by (–1).
2. “!” – Boolean «NOT» operation.
Zero–argument operators: Now, Date
Syntax. <ME>::= ( … | <Zero–argument operator> () | … )
<Zero–argument operator> ::= ( Now | Date )
Meaning.
The Date() and Now() operators return a one–dimensional Date value. The result is the current date for the Date() operator,
and current date and time for Now() (for example, 02.03.2001 12:48:46).
Type conversion operators: CDbl, CBool, CStr, CLng, CDate
Syntax. <МE>::= ( … | <Type conversion operator> (<MR1>)| … )
<Type conversion operator>::=( CDbl | CBool | CStr | CLng | CDate)
Meaning.
The value returned is the result of converting the operand into the respective type (CDbl – real, CBool – Boolean, CStr –
string, CLng – long, CDate – date). For more information, refer to the “Type conversion” section.
Example.
CDbl({``, `2.0`, `d4f`}) is {0, 2, #Error}
Use examples.
Let us assume we need to specify the following rule: the value of the «Summa» field on the page corresponding to the
«А» template is equal to the value of the «ResultSum» field of the page corresponding to the «А» template. If we specify a rule like this:
#A!Sum#=#B!ResultSum#, then, if the values of these fields are 2 and 2.00 respectively, the result will be False, as the string values do
not match. But if we specify the same rule as: CDbl(#A!Sum#)=CDbl(#B!ResultSum#), then the rule will be calculated correctly.
Note that if an expression is used, for example, 1* #A!Sum#=1*#B!ResultSum#, there will be no need to use a type conversion operator,
as the operands are automatically converted to the required type before the arithmetical operation begins.
Packing operators: Sum, Prod, Avg, Max, Min, Count, First, Last, NumMax, NumMin, Same,
Unique
Syntax. <ME>::= ( … |<Packing operator > (<MR1>) | … )
<Packing operator >::= ( Sum | Prod | Avg | Max | Min | Count | First| Last | NumMax | NumMin | Same | Unique )
Meaning.
The value of a packing operator is a single element, i.e. a packing operator is a function with an input value consisting of
several elements, but returning a value containing only one element. Before a packing operation begins, the following types of
conversion are performed: to the real type for all operations, except for Same, Unique, First, Last, and Count (there is no conversion
for these). If any result value contains at least one Error element, the result of the operation will also be Error. If the type conversion is
performed successfully, the only result element is calculated as follows:
1. For Sum, Prod and Avg, the result is the sum, multiplication and arithmetic mean of the input elements respectively.