> ## Documentation Index
> Fetch the complete documentation index at: https://docs.abbyy.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Relative search area

> Specify a relative search area on the Relations tab with Left of, Right of, Above, or Below relations to reference elements, boundaries, and offsets.

On the **Relations** tab of an element's **Properties** dialog box, you can specify a search area relative to other elements.

<Frame>
  <img src="https://mintcdn.com/abbyy/lqYknuOmCa79141v/images/flexi-capture/fls/Relations_tab.gif?fit=max&auto=format&n=lqYknuOmCa79141v&q=85&s=a743a34ab4dcee56001e0166e25c3ce6" alt="Screenshot of the Relations tab of an element's Properties dialog box in ABBYY FlexiLayout Studio, showing the Relations table and the Add, Edit, Duplicate, and Remove buttons." width="431" height="455" data-path="images/flexi-capture/fls/Relations_tab.gif" />
</Frame>

The **Properties** dialog box appears when you create a new element.

* To add a new relation, click **Add**. The **Add New Relation...** dialog box opens.
* To edit an existing relation, click **Edit**.
* To duplicate a selected relation, click **Duplicate**.
* To remove a selected relation, click **Remove**.

To open the **Properties** dialog box for an existing element, do one of the following:

* Right-click the element in the tree of elements and select **Properties...** on the shortcut menu.
* Double-click the element in the tree of elements.

In the **Properties** dialog box, click the **Relations** tab.

## Specify the boundaries of a search area relative to another element

In the **Add New Relation** or **Edit Relation** dialog box, specify the relation parameters:

<Steps>
  <Step title="Select the relation type">
    In the **Type** field, select **Left of**, **Right of**, **Above**, or **Below**.
  </Step>

  <Step title="Select a reference element">
    Click the <img src="https://mintcdn.com/abbyy/fmgRWFNHKYN2MLSg/images/flexi-capture/fls/Button_points.gif?s=494881c954b44aa8b446880d31ab4d12" alt="Browse button" style={{display:"inline-block",verticalAlign:"middle",margin:0}} width="19" height="18" data-path="images/flexi-capture/fls/Button_points.gif" /> button next to the **Reference element** field, and then select the element relative to which you define the search-area boundaries. For instructions on defining a search area relative to subelements of a repeating group, see [Use instances of a Repeating Group as reference, excluded, or source elements](/flexi-capture/fls/template/select-repeatable-group).
  </Step>

  <Step title="Select the reference boundary">
    In the **Reference boundary** field, select the boundary of the element's region relative to which you define the boundary of the search area.
  </Step>

  <Step title="Set the offset">
    In the **Offset** field, set the offset value for the boundary of the search area.
  </Step>

  <Step title="Add or save the relation">
    Click **Add Relation** to add a new relation, or **Save Changes** to save the relation after editing. All relations are displayed in the **Relations** table.
  </Step>
</Steps>

You can also select the relation type, the element boundary, and the offset type (negative, zero, or positive) using pictures in the **Choose relation parameters by picture** dialog box. On the **Left of**, **Right of**, **Above**, and **Below** tabs, you can see the relative position of the element and the search area, and how the search area changes depending on the selected boundary and offset types.

To open the **Choose relation parameters by picture** dialog box, click **Choose...** in the **Add New Relation** or **Edit Relation** dialog box.

<Frame>
  <img src="https://mintcdn.com/abbyy/lqYknuOmCa79141v/images/flexi-capture/fls/choose_relation.PNG?fit=max&auto=format&n=lqYknuOmCa79141v&q=85&s=ebe0c0f3e2976f5cff6d032da54ba961" alt="Screenshot of the Choose relation parameters by picture dialog box on the Above tab, showing pictures of how the search area relates to the reference element for Top, Bottom, and Center boundaries with negative, zero, and positive offsets, plus a legend." width="479" height="523" data-path="images/flexi-capture/fls/choose_relation.PNG" />
</Frame>

<Note>
  The elements used as reference elements and the elements excluded from the search area must be located higher up the tree of elements than the element for which the constraint is being specified.
</Note>

ABBYY FlexiLayout Studio lets you keep several **Properties** dialog boxes open at the same time.

To copy a property that defines the boundary of a search area, select it in the **Relations** table and drag it into the **Properties** dialog box of another element. You can copy the constraints specified on the **Advanced** tab in the same way.

## <a id="visualizationofrelations" />Visualization of relations

When you edit relation properties or select a relation in the **Relations** table, the relation appears in the **Image** window. The reference element is enclosed in a thick frame, and the search area is highlighted with a green background.

<Frame>
  <img src="https://mintcdn.com/abbyy/r-nfa7jujx5b9gKX/images/flexi-capture/fls/selected_relation.png?fit=max&auto=format&n=r-nfa7jujx5b9gKX&q=85&s=69b8d05ef05af53a2ec98175787cef4c" alt="Screenshot of a relation visualized in the Image window next to the Relations tab of the Properties dialog box, where the reference element is enclosed in a thick frame and the search area is highlighted with a green background." width="565" height="287" data-path="images/flexi-capture/fls/selected_relation.png" />
</Frame>

When you edit the boundary type and offset value, the search area in the **Image** window changes accordingly.

In **Reference layout** mode, you can also drag the offset boundary with the mouse directly in the **Image** window to change the offset value. If **Matched layout** is selected, the relation is displayed in read-only mode, and offsets cannot be edited in the **Image** window.

When you select several relations, the intersection of the selected relations is displayed. The intersection area is highlighted with a green background, and the areas outside the intersection borders are highlighted in blue.

<Frame>
  <img src="https://mintcdn.com/abbyy/8aWHPAJyzWmTqglX/images/flexi-capture/fls/visual.PNG?fit=max&auto=format&n=8aWHPAJyzWmTqglX&q=85&s=542cc56710ad18b56b05aa0ef5968f0a" alt="Screenshot of several relations visualized in the Image window next to the Relations tab of the Properties dialog box, where the intersection of the selected relations is highlighted with a green background and the areas outside it are highlighted blue." width="794" height="544" data-path="images/flexi-capture/fls/visual.PNG" />
</Frame>

## Select the element closest to a certain object

The **Nearest** property tells the program that, all other things being equal, it must look for a hypothesis located closest to a certain element or point on the image. Specify the closest element, point, or coordinate axis in the **Nearest** property of the element.

To instruct the program to select the element closest to a certain object on the image, select the **Nearest** option, and then choose the object from the **To** drop-down list.

The option you select determines what else you specify:

| Option               | What to specify                                             |
| -------------------- | ----------------------------------------------------------- |
| **Element**          | The name of the element in the **Reference element** field. |
| **X coordinate**     | The X-coordinate value.                                     |
| **Y coordinate**     | The Y-coordinate value.                                     |
| **Point**            | The coordinates of the point.                               |
| **Page top edge**    | No additional value is required.                            |
| **Page bottom edge** | No additional value is required.                            |
| **Page left edge**   | No additional value is required.                            |
| **Page right edge**  | No additional value is required.                            |

The **Minimum quality** parameter specifies the minimum quality of the element hypothesis. By default, its value is equal to the quality of the null hypothesis.

<Note>
  The element closest to the given element is selected based on the shortest distance between element centers.
</Note>

For more information, see [Search for elements with Nearest and FuzzyQuality](/flexi-capture/fls/tips-tricks/date9).

## Related topics

* [Search constraints](/flexi-capture/fls/template/basic-constraints)
* [Additional search constraints](/flexi-capture/fls/template/advanced-constraints)
