> ## 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 4: Analyze the images to decide in which order elements must be detected

> Plan the element search order for the invoice FlexiLayout in Sample 3: analyze field arrangement and outline the InvoiceHeader group and its elements.

Before you create any elements, decide the following:

* Is there a pattern in how the fields are arranged on the images?
* Which elements can serve as reference elements for field detection?
* What element search order works best? At each new step, you can refer only to previously described elements.

Analyze the available images.

The central part of every image contains a table.

<Info>
  In FlexiLayout Studio, a table is an image object made up of fragments that consist of rows and columns visually separated by separator lines or by white gaps. For more information, see [Work with tables](/flexi-capture/fls/tables/general-tables).
</Info>

Above the table is a group of fields you can name **InvoiceHeader**: **Invoice Number**, **Invoice Date**, and **Delivery Address**. The **Invoice Number** field occurs on all the images and can serve as an identifier field, while **Invoice Date** and **Delivery Address** are optional.

Below the table is a group of fields you can name **Footer**: **TotalQuantity**, **TotalAmount**, and **Country**. These fields also do not occur on all the images.

## Plan the search for the upper fields

Start with the fields in the upper part of the document. Create a logical [Group](/flexi-capture/fls/template/elements-compound) element named **InvoiceHeader** that unites all the elements used to find the **Invoice Number**, **Invoice Date**, and **Delivery Address** fields.

These three fields are always in the upper left corner, and their order is always the same: **Delivery Address**, followed by **Invoice Number**, followed by **Invoice Date** (when they occur on the image). Look for them in that order.

To find the field-name keywords, use [Static Text](/flexi-capture/fls/template/static-text) elements. The **InvoiceHeader** element must contain these name elements:

| Element               | Type                                                   | Corresponds to                         | Described in                                  |
| :-------------------- | :----------------------------------------------------- | :------------------------------------- | :-------------------------------------------- |
| **kwDeliveryAddress** | [Static Text](/flexi-capture/fls/template/static-text) | Name of the **Delivery Address** field | [Step 5](/flexi-capture/fls/tutorial3/3step5) |
| **kwInvoiceNumber**   | [Static Text](/flexi-capture/fls/template/static-text) | Name of the **Invoice Number** field   | [Step 6](/flexi-capture/fls/tutorial3/3step6) |
| **kwDate**            | [Static Text](/flexi-capture/fls/template/static-text) | Name of the **Invoice Date** field     | [Step 7](/flexi-capture/fls/tutorial3/3step7) |

Search for the **Invoice Number** and **Invoice Date** fields in the same row as their names, to the right of the names. In the **InvoiceHeader** element, create these field elements:

| Element           | Type                                                            | Corresponds to                                           | Described in                                  |
| :---------------- | :-------------------------------------------------------------- | :------------------------------------------------------- | :-------------------------------------------- |
| **InvoiceNumber** | [Character String](/flexi-capture/fls/template/character-chain) | The **Invoice Number** field                             | [Step 8](/flexi-capture/fls/tutorial3/3step8) |
| **grDate**        | [Group](/flexi-capture/fls/template/elements-compound)          | Groups the elements that find the **Invoice Date** field | [Step 9](/flexi-capture/fls/tutorial3/3step9) |

In the `InvoiceHeader.grDate` element, create:

| Element                 | Type                                                            | Corresponds to                                                                               | Described in                                  |
| :---------------------- | :-------------------------------------------------------------- | :------------------------------------------------------------------------------------------- | :-------------------------------------------- |
| **InvoiceDate**         | [Date](/flexi-capture/fls/template/date)                        | The **Invoice Date** field on good-quality images                                            | [Step 9](/flexi-capture/fls/tutorial3/3step9) |
| **InvoiceDateAsString** | [Character String](/flexi-capture/fls/template/character-chain) | The **Invoice Date** field when FlexiLayout Studio does not find the **InvoiceDate** element | [Step 9](/flexi-capture/fls/tutorial3/3step9) |

For more information about finding dates on poor-quality images, see [Date search after high or low-quality recognition](/flexi-capture/fls/tips-tricks/date2).

## Plan the search for the Delivery Address field

The **Delivery Address** field has multiple lines, so use a [Paragraph](/flexi-capture/fls/template/text-chain) element to detect it. Before creating that element, limit the search area as much as possible. Use a [White Gap](/flexi-capture/fls/template/white-gap) element for the right boundary of the search area.

Group all the elements that describe the location of the **Delivery Address** field into a [Group](/flexi-capture/fls/template/elements-compound) element. In the **InvoiceHeader** element, create a **Group** element named **grAddress**. For more information, see [Step 10](/flexi-capture/fls/tutorial3/3step10).

In the **grAddress** element, create:

| Element             | Type                                                | Corresponds to                                                             | Described in                                    |
| :------------------ | :-------------------------------------------------- | :------------------------------------------------------------------------- | :---------------------------------------------- |
| **wgAddressRight**  | [White Gap](/flexi-capture/fls/template/white-gap)  | Auxiliary element that borders the **Delivery Address** field on the right | [Step 11](/flexi-capture/fls/tutorial3/3step11) |
| **DeliveryAddress** | [Paragraph](/flexi-capture/fls/template/text-chain) | The **Delivery Address** field                                             | [Step 12](/flexi-capture/fls/tutorial3/3step12) |
