English (English)

Name scope

Names of elements, constants and variables can be used only in certain sections of a program. This is called the "scope" of the name. The scope of a variable also determines its lifetime.

The name of a variable declared in the Region expression, Advanced pre-search relations or Advanced post-search relations section is accessible within that section, and only after the point of declaration.

A name declared within a block is accessible only within that block and the blocks enclosed by it, and only after the point of declaration:

{
Int a; a = 5;
}

Element hypotheses can be accessed through the names of the elements. In the Advanced pre-search relations and Advanced post-search relations sections, you can access the hypotheses for all the elements which are located above the current element in the FlexiLayout tree. In the Advanced post-search relations section, you can also access the hypothesis formulated for the current element itself. In the Region expression section of a block description, you can access the hypotheses for all the elements located on the "best branch" of the tree of hypotheses.

The code in the Advanced pre-search relations section is executed separately for each hypothesis independently of the hypotheses which are located on other branches of the tree of hypotheses. This means that when the program executes the code of a particular section of an element description, it can access only one hypothesis for each superordinate element, namely the hypothesis which is located on the same branch.

Element hypotheses and their properties are accessed in read-only mode.

Hypotheses for a superordinate element are called by the full name of the element, for example: SearchObjects.Group1.Group2.FirstItem. When accessing one subelement of a group from another subelement, you need not specify the name of the group. For example, in the Advanced… sections of the element SearchObjects.Group1.Group2.SecondItem, you can call the element SearchObjects.Group1.Group2.FirstItem in one of the following ways: SearchObjects.Group1.Group2.FirstItem, Group1.Group2.FirstItem, Group2.FirstItem, FirstItem.

The shortcut name will always refer to the most nested element.

Suppose we have the following tree of elements:

SearchElements
FirstItem
Group1
FirstItem
SecondItem

If you are in SearchElements.Group1.SecondItem and use the name FirstItem, you will call the SearchElements.Group1.FirstItem element, and not the SearchElements.FirstItem element.

4/12/2024 6:16:02 PM

Please leave your feedback about this article

Usage of Cookies. In order to optimize the website functionality and improve your online experience ABBYY uses cookies. You agree to the usage of cookies when you continue using this site. Further details can be found in our Privacy Notice.