> ## 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 9: TotalAmount field, SumGroup Group element

> Group the Total Amount search in a SumGroup element constrained to look below the detected invoice table, hosting the kwTotal and TotalAmount subelements.

After you analyze the test documents, you will notice that the **Total Amount** field occurs only together with the field name, on the last page below the table. The field itself is either on the same level as the field name or below it. Because the field contains only one line, use a [Character String](/flexi-capture/fls/template/character-chain) element to search for it.

To set the properties common to the field and its name, use a **Group** element.

## Create the SumGroup group element

<Steps>
  <Step title="Create the Group element">
    Create a [Group](/flexi-capture/fls/template/elements-compound) element and name it **SumGroup**.
  </Step>

  <Step title="Restrict the search area">
    Click the **Advanced** tab and, in the **Advanced pre-search relations** field, specify an additional search constraint for all the elements in the group: search for the object below the last detected table. In the [FlexiLayout language](/flexi-capture/fls/code/general-code):

    ```text theme={null}
    If not InvoiceTable.LastSubTable.Body.IsNull then
    Below: InvoiceTable.LastSubTable.Body.Rect.Bottom;
    ```
  </Step>
</Steps>

The SumGroup group includes these elements:

| Element         | Type                                                            | Detects                                         | Described in                                      |
| :-------------- | :-------------------------------------------------------------- | :---------------------------------------------- | :------------------------------------------------ |
| **kwTotal**     | [Static Text](/flexi-capture/fls/template/static-text)          | The keywords in the **Total Amount** field name | [Step 9.1](/flexi-capture/fls/tutorial4/4step9-1) |
| **TotalAmount** | [Character String](/flexi-capture/fls/template/character-chain) | The one-line **Total Amount** field value       | [Step 9.2](/flexi-capture/fls/tutorial4/4step9-2) |
