> ## 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.

# Sample 4. Step 5.1: Name of Invoice Number field, kwInvoiceNumber element

> Define the required kwInvoiceNumber Static Text element that finds the Invoice Number field name and serves as the identifier for the invoice document type.

When you examine the images, you will notice the following:

* The name of the **Invoice Number** field appears on all the images, and it distinguishes this document from others. Make the field name a required element so it serves as the identifier for this document type. For more information, see [Required, optional, and prohibited elements](/flexi-capture/fls/template/elements-optional).
* The name may contain one of these phrases: `Invoice no.`, `Credit note No`, `Invoice Number:`, or `Invoice Number`. List all the possible variants in the search string. Type each phrase without spaces, so that the maximum number of errors applies to the whole phrase and not to separate words.
* Only the field on the first page, in the upper part, is of interest. Some first pages contain static text similar to the name but located at the bottom of the page.

## Create the kwInvoiceNumber element

<Steps>
  <Step title="Create the Static Text element">
    In the **InvoiceHeader** element, create a [Static Text](/flexi-capture/fls/template/static-text) element and name it **kwInvoiceNumber**.
  </Step>

  <Step title="Mark the element as required">
    On the **General** tab, select **Required element**.
  </Step>

  <Step title="Enter the search text">
    Click the **Static Text** tab. In the **Search text** field, type `InvoiceNo.|CreditNoteNo|InvoiceNumber:|InvoiceNumber`.
  </Step>

  <Step title="Set the maximum error percentage">
    Set **Max error percentage** to 20.
  </Step>

  <Step title="Specify the search area">
    Click the **Search Constraints** tab and use absolute coordinates to specify the rectangular search area on the first page:

    * Select **Absolute search area constraints**.
    * In the **Pages** field, select **Range** from the drop-down list.
    * In the **Range** field, type `1`.
    * In the **Region** field, specify the coordinates of the rectangle `[1, 1, 2475, 1878]`.
    * Click **Add...**. The search area appears in the **Search areas** list.

    <Frame>
      <img src="https://mintcdn.com/abbyy/8aWHPAJyzWmTqglX/images/flexi-capture/fls/tutorial4_5_1.png?fit=max&auto=format&n=8aWHPAJyzWmTqglX&q=85&s=5cba6cb00be6fe0d9cf20e7d15b7927b" alt="Screenshot of the Search Constraints tab of the kwInvoiceNumber Static Text element properties in ABBYY FlexiLayout Studio, showing absolute search area constraints with the page range and the rectangular region coordinates added to the search areas list." width="427" height="454" data-path="images/flexi-capture/fls/tutorial4_5_1.png" />
    </Frame>
  </Step>

  <Step title="Add pre-search relations">
    Click the **Advanced** tab. In the **Advanced pre-search relations** field, specify additional constraints:

    ```text theme={null}
    WholeWordMode: true;// Only whole text objects will be treated as possible hypotheses
    MaxGapInLine: 50dt;// The maximum distance between neighboring words
    ```
  </Step>

  <Step title="Add post-search relations">
    An additional check in the **Advanced post-search relations** field influences the quality of the generated hypotheses. For example, if the element is detected, calculate the difference between the reference width and the width of the detected element's region, and check whether it belongs to the fuzzy interval. In the [FlexiLayout language](/flexi-capture/fls/code/general-code):

    ```text theme={null}
    If not IsNull then
    { FuzzyQuality: 600dt - width, {-70000,0,0,70000}*dt;
    }
    //This condition means that the greater the difference, the greater the penalty
    ```

    <Info>
      To specify object locations and the distances between them, FlexiLayout Studio uses a two-dimensional coordinate system. The (0, 0) point, where the vertical and horizontal axes intersect, is in the top left corner of the image. The horizontal axis runs left to right, and the vertical axis runs top to bottom.
    </Info>
  </Step>

  <Step title="Match the FlexiLayout">
    Temporarily exclude the **InvoiceFooter** element and match the FlexiLayout.

    <Tip>
      To exclude an element, select it in the tree of elements and select **Disable** from the **FlexiLayout** menu.
    </Tip>
  </Step>
</Steps>
