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

Once you have analyzed 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. Additionally, the field itself is either on the same level as the field name or below the name. Since the field contains only one line, create a Character String element to search for it.

To specify the settings common to the field and its name, use a Group element.

To create a SumGroup element:

1. Create an element of type Group and name it **SumGroup**.
2. Click the Advanced tab and in the Advanced pre-search relations field, specify additional search constraints 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), this constraint can be written as follows:

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

To search for the keywords in the TotalAmount field, use a SumGroup.kwTotal element of type Static Text. For detailed instructions, see [Step 9.1](/flexi-capture/fls/tutorial4/4step9-1).

To search for the one-line TotalAmount field, use a SumGroup.TotalAmount element of type Character String. For detailed instructions, see [Step 9.2](/flexi-capture/fls/tutorial4/4step9-2).
