> ## 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 3. Step 7: Detect the name of the Invoice Date field with a kwInvoiceDate element

> Find the Invoice Date field name with a kwInvoiceDate Static Text element, using relations and offsets to narrow the search for the short word Date.

The name of the **Invoice Date** field is a short and very common word, `Date`. Restrict the search area as much as possible. Whenever the **Invoice Date** field name occurs on an image, it is located very close to the name of the **Invoice Number** field.

## Create the kwInvoiceDate 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 **kwInvoiceDate**.
  </Step>

  <Step title="Enter the search text">
    Click the **Static Text** tab. In the **Search text** field, enter `Date`.
  </Step>

  <Step title="Set the error tolerance">
    Leave 30 as the value for **Max error percentage**. For the four-letter search word, this means no more than one error.
  </Step>

  <Step title="Set the location relations">
    Click the **Relations** tab. The keywords of the name can occur only below the **Invoice Number** field name, but no more than 150 dots below its bottom boundary, so set these relations:

    * **Below** the **kwInvoiceNumber** element, **Offset** = 0
    * **Above** the bottom of the **kwInvoiceNumber** element, **Offset** = -150, **Reference boundary** = **Bottom**

    <Frame>
      <img src="https://mintcdn.com/abbyy/8aWHPAJyzWmTqglX/images/flexi-capture/fls/tutorial3_7.png?fit=max&auto=format&n=8aWHPAJyzWmTqglX&q=85&s=f4fd4defbc257046fa343c968cfa67eb" alt="Screenshot of the Relations tab of the Properties of SearchElements.InvoiceHeader.kwInvoiceDate dialog box in ABBYY FlexiLayout Studio, showing the Below and Above relations to the kwInvoiceNumber element." width="431" height="455" data-path="images/flexi-capture/fls/tutorial3_7.png" />
    </Frame>

    <Tip>
      To select the best offset values, analyze the geometrical properties (size and boundaries) of the objects detected during pre-recognition.
    </Tip>
  </Step>

  <Step title="Add the search-area constraint">
    Click the **Advanced** tab. Since the **Invoice Date** field is in the left half of the image, set this [additional search constraint](/flexi-capture/fls/template/advanced-constraints) in the **Advanced pre-search relations** field: look for the object in the left half of the image. In the [FlexiLayout language](/flexi-capture/fls/code/general-code):

    ```text theme={null}
    LeftOf: PageRect.Left + PageRect.Width/2;
    ```
  </Step>

  <Step title="Verify the match">
    Match the FlexiLayout with the test images and confirm that FlexiLayout Studio detects the element on all the images where applicable.
  </Step>
</Steps>
