English (English)

Additional search constraints for a Repeating Group element

The Properties dialog box of a Repeating Group element provides two tabs where you can specify additional search constraints: Advanced and Advanced for All Instances. On the Advanced tab, you can specify additional search constraints for individual instances of the group. On the Advanced for All Instances tab, you can specify additional search constraints for all the instances of the group.

Show Properties dialog box

, Advanced for All Instances tab

In the External Fields for All Instances section, you can use all the methods available for a Group element. For example, you can specify relations with already detected instances:

// Each subsequent instance is located below the previous instance
if SearchElements.RepeatingGroup.HasInstances then {
Below: SearchElements.RepeatingGroup.LastFound, 0 * dot;
}

In the Advanced pre-search relations for all instances section, you can use the following methods:

  • MinRepetitions
  • MaxRepetitions
  • PaginalMode
  • MinRepetitionsOnPage
  • MaxRepetitionsOnPage

In the Post-search relations section, you can provide an estimate for a particular instance. In the Post-search relations for all instances section, you can provide an estimate for all the detected instances.

In the Pre-search relations section, you can use all the methods available for a Group element.

Sample code for Post-search relations:

// Checking the hypotheses for the subelements StaticText1 and StaticText2 in a repeating group. The last detected instance is used.
if StaticText1.Width() < 200dt and StaticText2.Width() < 200dt then Quality: 0.98;

Sample code for Post-search relations for all instances:

if InstancesCount() < 5 and LastFound.Pages.End <= 2 then Quality: 0.98;

Accessing element instances

Use the following pre-defined names to access element instances:

  • LastFound - the last detected instance
  • CurrentInstance - the current instance when searching inside a repeating element
  • Instance ( n ) – instance No. n
  • AllInstances - all instances

You can access subelements of a Repeating Group element even they are located lower down the tree of elements. The following methods of the FlexiLayout language can also be used to work with element instances:

  • HasInstances - checks if any instances have already been found
  • InstancesCount - returns the number of detected instances

Condition for stopping the search for element instances

The search for instances stops (in the given branch) if the program encounters an empty hypothesis for a group (i.e. a group that has an empty region) or if the program cannot generate any more hypotheses (there are no more hypotheses in the search area). In Paginal mode, this rule applies to search on one page only. When the program finishes search on one page, it goes on to the next page. MinRepetitionsOnPage, MaxRepetitionsOnPage, MinRepetitions, and MaxRepetitions also affect the hypotheses generation process.

You can use the following methods to change the standard hypotheses generation process:

  1. The last detected instance must be the last one:
    if SearchElements.RepeatingGroup.HasInstances and then DontFind;
    This condition must be entered in Advanced pre-search relations.
  2. The last detected instance (and it is this instance that we are creating the constraint for) is "bad" and the previous instances must be the last (if there re no other "good instances detected"):
    If then Quality: 0;
    This condition must be entered in Advanced post-search relations.

See also:

FlexiLayout language

25.05.2023 7:55:03

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.