6.5

© 2007 ABBYY. All rights reserved.
54
SubStr({`Olga`, 23, `ffe`, `Mary`}, 1, 1) is {`O`, `2`, `f`, `M`}
SubStr({`Olga`, 23, `ffe`, `Mary`}, {1, 2, 3, 4}, 1) is {`O`, `3`, `e`, `y`}
Use examples. If you want all the ‘DocCode’ fields of all pages corresponding to the ‘A’ template to begin with the prefix ‘_D’, specify
the following rule: SubStr (#A!DocCode#,1,2) = `_D`.
Selection operator: IIf
Syntax. <MR>::= ( … | IIf (<MR1> , <MR2> , <MR3>)| … )
Meaning.
The meaning of the operator is as follows: the MR1 operand is a selection condition. If its value is True, the resulting value
will be MR2; if it is False, the result will be MR3. The IIf operation can be performed in two ways: element–by–element or over the
entire values depending on the dimension of the first operand:
If the value of the first operand is a single element, then the select operator affects the entire values. If this single element is True,
the resulting value will be the second operand value, otherwise – the third operand value.
If the value of the first operand contains more than one element, the select operation is performed element–by–element. Before
the operation begins, the dimensions of all the three operands are matched. The resulting value is a collection of elements. Each
element is got as follows: if the first element is True, the respective element of the second operand will be the result, otherwise the
third one.
Examples.
IIf(1, {23,`Fg`, 0, 87}, {0,True}) is {23,`Fg`, 0, 87}
IIf(False, {1,2,3,4}, {5,6,7,8}) is {5,6,7,8}
IIf({1, False, 0, 2}, {1,2,3,4}, {5,6,7,8}) is {1,6,7,4}
IIf({1,0,True,False}, 1, 5) is {1,5,1,5}
Substring replace operator: Replace
Syntax. <MR>::= ( … | Replace ( <MR1> , <MR2> , <MR3>) | … )
Meaning. Before the operation begins, all the operands are converted to the string type. Then the dimensions of all the three operands
are matched. If this operation is performed successfully, the resulting dimension will be the maximum of the operand dimensions (the
result itself is a string). The first operand is the string in which the search is performed, the second is what is being searched, snd the
third is the substring with which the search pattern will be replaced. The result will be the first operand with all the occurrences of the
search pattern replaced with the specified substring.
Example.
Replace ({`ghsko22fghj2`,`222`}, `22`, `0`) is {`ghsko0fghj2`,`02`}
Data creation operator: DateSerial
Syntax. <MR>::= ( … | DateSerial ( <MR1> , <MR2> , <MR3> ) | … )
Meaning. Before the operation begins, all the operands are converted to the real type. Then the dimensions of all the three operands
are matched. If this operation is performed successfully, the result dimension will be the maximum of the operand dimensions; the
result itself will be of the Date type. Each element will be a date made up of three parts: the first operand element is the day, the
second operand element is the month, and the third operand element is the year.
Example.
DateSerial (2001, {2,3}, {20,21}) is { 20.2.01, 21.3.01}
Glue operator: Array
Syntax. <MR>::= ( … | Array (<MR1> , <MR2> , ... , <MRN> ) | … )
Meaning.
The glue operator “glues” all the values of all operands in a single resulting value. The dimension of this value is the sum of
the dimensions of the operands.
Examples.
Array({1, 23, `ffe`, True}, {0,1}, {}, {True}) is {1, 23, `ffe`, True, 0,1, True}
Use examples.
Let the ‘DocType’ fields on all pages corresponding to the ‘А’ and ‘В’ templates be the same. You can specify the
following rule: Same(Array(#A!DocType#, #B!DocType#))
VBScript for ABBYY FormReader Enterprise Edition
General scope
A VBScript–rule is a program written in the VBScript language. It can use the values of the other form fields, ABBYY FormReader
Enterprise Edition predefined functions as well as any standard VBScript functions. Besides that, the user can define global constants
and functions and use formulae for calculating expressions.
In order to create custom functions, the Form Page Access API is available.
Creating custom functions by using the Form Page Access API
The API consists of primary types (enumerations) and five classes:
FormDocument
FormPage