6.5

© 2007 ABBYY. All rights reserved.
49
Multi–dimensional constant
Syntax. { <One–dimensional constant> { , <One–dimensional constant>} }
Value. The expression value is a collection consisting of one–dimensional constant values.
Sample expression.
{5, `Name`, 4.5, true}
Page field reference
Syntax. # ( <Template name> | * ) ! <Field name> #
Meaning.
The “visibility scope” of a document is the pages directly contained in it; the pages contained in its children are not “visible.”
If the template name is specified, the expression value is a collection containing the values of fields with the specified name located
on all the document pages corresponding to the specified template. The order of values in the collection corresponds to the order of
the pages in the document. If there are no pages matched with the specified template or there are no fields of the specified name, the
value is an empty collection. If the «*» character is used instead of the template name, the collection includes the fields with the
specified name located on all document pages regardless of their template.
Sample expression.
#Reference !Surname#
MR document reference
Syntax. #^ (<Document type name> | * | me ) ! <MR name> #
Comments on syntax.
Note that in contrast to a reference to a page field, the «^» character specifying the reference type follows the
opening «#» character. If this character is lacking, the reference is considered to be a page field reference.
Meaning.
The “visibility scope” of a document is the documents directly contained in it; the pages contained in its children are not
“visible.” There are three variants of reference syntax:
Variant 1. Reference to the MR of a certain document template.
The value is a collection containing the values of the MR with the specified name of all the nearest document children corresponding
to the specified template. Note that the value of each MR may also be a collection, so that the value of the reference will be a
collection containing all the elements of the corresponding collections in the order of the respective subdocuments in the document.
If there are no subdocuments corresponding to the specified template, or they do not contain MR with the specified name, the
expression value will be an empty collection.
The arguments may be any document MRs, including rules.
Example.
#^ UserCard !IsNumberCorrect#
Variant 2. The character «*» is used instead of the document template.
The expression value is a collection including all subdocuments regardless of their templates.
Example.
# ^* ! Number #
Variant 3. The word “me” is used instead of a document template.
Only the document’s MRs are searched, not the ones of its children. Thus, you can select a frequently repeated expression and then
include it as a separate multipage parameter in other document MRs by using the #^me!MR name# reference.
Example.
# ^me !ResultSum #
Now let us consider multipage rules that contain various operators. The value of such rules depends on the values of the operands that
are multipage expressions themselves. Therefore, the values of the operands are always calculated first, and then the value of the
multipage expression is calculated. The operations are quite various, but they all share two common properties: dimension matching
and type conversion.
Dimension matching
As has already been said, the value of a multipage expression is a collection of constants. So the values of the expression operands may
have different dimensions. In some cases it does not contradict the meaning of the expression, whilst in other cases the operands’
dimensions must be the same. In the latter case dimension matching is performed.
The input values are the operand values, and each value itself may be a collection of constants. During matching, the program checks
if the dimensions of the given operand values can be matched, and if they can, the positive result is returned and the values are
corrected so that their dimensions will be the same. If they cannot be matched, the negative result is returned. The matching rules are
as follows:
1. If there is a single value of the zero dimension, all the values are assigned zero dimension, i.e. they become empty collections.
2. If there are two values with the dimensions more than 1 and not the same, the negative result is returned – the dimensions cannot
be matched.
3. Any value’s dimension is either equal to 1 or coincides with the maximum dimension (if the maximum is more than 1). In this case
all the dimensions are carried to the maximum: the values having the dimension of 1 are supplied with the necessary number of
additional constants that duplicate the first one.
So, if the matching is successful, all the operands will have the same dimension.
The process is best illustrated by the following examples:
Examples.
If the input values are {2,1,`dc`,0,4}, {2,3}, {}, the output values will be {}, {}, {}.
If the input values are {2,1,`dc`,0,4}, {2,3}, {1}, the result will be negative – the dimensions cannot be matched.
If the input values are {2,1,`dc`,0,4}, {2}, {1}, the output values will be {2,1,`dc`,0,4}, {2,2,2,2,2}, {1,1,1,1,1}.
If the input values are {2,1,`dc`,0,4}, {2,3,1,4,2}, {1}, the output values will be {2,1,`dc`,0,4}, {2,3,1,4,2}, {1,1,1,1,1}.
Use examples.