> ## 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 26: Detect the Table element with an InvoiceTable element

> Assemble the InvoiceTable Table element: configure columns, ordering rules, header, footer, and master columns to detect the invoice table reliably.

Now that all the preparations are complete, you can search for the Invoice Table field. A [Table](/flexi-capture/fls/tables/general-tables) element detects it, using the strategy decided in [Step 13](/flexi-capture/fls/tutorial3/3step13):

* **Header** – The **Reference** and **Designation** column names use keywords; the **Quantity**, **Unit Price**, and **Total** column names use the auxiliary elements you described.
* **Footer** – The previously described keyword element detects it.
* **Search area** – The **Sales** column name restricts the search area on the right.

## Create the InvoiceTable element

<Steps>
  <Step title="Create the Table element">
    Create an element of type [Table](/flexi-capture/fls/tables/general-tables) and name it **InvoiceTable**.
  </Step>

  <Step title="Select the table block">
    Click the **Columns** tab, click **Select**, and specify the previously described **InvoiceTable** block as the block this element detects. For more information, see [Step 3](/flexi-capture/fls/tutorial3/3step3).
  </Step>

  <Step title="Configure the Reference and Designation columns">
    Select the **Reference** column and click **Properties...**. The keyword **Reference** finds this column name, so leave the default values. Do the same for the **Designation** column.
  </Step>

  <Step title="Configure the Quantity column">
    Select the **Quantity** column and click **Properties...**. To find this column name, use the previously detected `TableHeader.kwQuantity` element: select **Use found element as column name**, click <img src="https://mintcdn.com/abbyy/fmgRWFNHKYN2MLSg/images/flexi-capture/fls/Browse_Button.gif?s=3673db30dda4a3293aec716853588b55" alt="Browse button" style={{display:"inline-block",verticalAlign:"middle",margin:0}} width="21" height="20" data-path="images/flexi-capture/fls/Browse_Button.gif" />, and select the `TableHeader.kwQuantity` element.

    <Frame>
      <img src="https://mintcdn.com/abbyy/r-nfa7jujx5b9gKX/images/flexi-capture/fls/tutorial3_26_1.png?fit=max&auto=format&n=r-nfa7jujx5b9gKX&q=85&s=bbf25b0bc0343d5c5c77393f46a0f892" alt="Screenshot of the Properties of column Quantity dialog box in ABBYY FlexiLayout Studio, with Use found element as column name selected and set to SearchElements.TableHeader.kwQuantity." width="462" height="377" data-path="images/flexi-capture/fls/tutorial3_26_1.png" />
    </Frame>
  </Step>

  <Step title="Configure the UnitPrice column">
    Select the **UnitPrice** column and click **Properties...**. Use the previously detected `TableHeader.kwUnitPrice` element: select **Use found element as column name**, click <img src="https://mintcdn.com/abbyy/fmgRWFNHKYN2MLSg/images/flexi-capture/fls/Browse_Button.gif?s=3673db30dda4a3293aec716853588b55" alt="Browse button" style={{display:"inline-block",verticalAlign:"middle",margin:0}} width="21" height="20" data-path="images/flexi-capture/fls/Browse_Button.gif" />, and select the `TableHeader.kwUnitPrice` element.

    <Frame>
      <img src="https://mintcdn.com/abbyy/r-nfa7jujx5b9gKX/images/flexi-capture/fls/tutorial3_26_2.png?fit=max&auto=format&n=r-nfa7jujx5b9gKX&q=85&s=b659e5d615579177f79b061be15ed775" alt="Screenshot of the Properties of column UnitPrice dialog box in ABBYY FlexiLayout Studio, with Use found element as column name selected and set to SearchElements.TableHeader.kwUnitPrice." width="462" height="377" data-path="images/flexi-capture/fls/tutorial3_26_2.png" />
    </Frame>
  </Step>

  <Step title="Configure the Total column">
    Select the **Total** column and click **Properties...**. Use the previously detected `TableHeader.kwTotal` element: select **Use found element as column name**, click <img src="https://mintcdn.com/abbyy/fmgRWFNHKYN2MLSg/images/flexi-capture/fls/Browse_Button.gif?s=3673db30dda4a3293aec716853588b55" alt="Browse button" style={{display:"inline-block",verticalAlign:"middle",margin:0}} width="21" height="20" data-path="images/flexi-capture/fls/Browse_Button.gif" />, and select the `TableHeader.kwTotal` element.
  </Step>

  <Step title="Add a column-order rule">
    Click the **Order** tab. Other columns (for example, **Unit**) can appear between the sought columns, but the sought columns always appear in this order: **Reference**, **Designation**, **Quantity**, **Unit Price**, **Total**. Select **Rules for column order**, click **Add...**, and specify this order: `Reference << Designation << Quantity << Unit Price << Total`.

    <Frame>
      <img src="https://mintcdn.com/abbyy/r-nfa7jujx5b9gKX/images/flexi-capture/fls/tutorial3_26_3.png?fit=max&auto=format&n=r-nfa7jujx5b9gKX&q=85&s=b471ef36cc0fb3b34730fd749baf7c1b" alt="Screenshot of the Order tab of the Properties of SearchElements.InvoiceTable dialog box in ABBYY FlexiLayout Studio, with Rules for column order selected and a rule listing Reference, Designation, Quantity, Unit Price, and Total in order." width="601" height="507" data-path="images/flexi-capture/fls/tutorial3_26_3.png" />
    </Frame>
  </Step>

  <Step title="Order the columns in the rule">
    In the **Edit Column Order Rule** dialog box, move the columns into the **Selected columns** list in the order **Reference**, **Designation**, **Quantity**, **UnitPrice**, **Total**.

    <Frame>
      <img src="https://mintcdn.com/abbyy/8aWHPAJyzWmTqglX/images/flexi-capture/fls/tutorial3_26_4.png?fit=max&auto=format&n=8aWHPAJyzWmTqglX&q=85&s=dc2e164e6c1d5179ae56fb3614cf780b" alt="Screenshot of two Edit Column Order Rule dialog boxes in ABBYY FlexiLayout Studio, showing the available columns being moved into the Selected columns list in the order Reference, Designation, Quantity, UnitPrice, Total." width="431" height="455" data-path="images/flexi-capture/fls/tutorial3_26_4.png" />
    </Frame>
  </Step>

  <Step title="Configure the header">
    Click the **Header** tab. The header is needed, but it needs no search constraints, so leave the default values.

    <Frame>
      <img src="https://mintcdn.com/abbyy/8aWHPAJyzWmTqglX/images/flexi-capture/fls/tutorial3_26_5.png?fit=max&auto=format&n=8aWHPAJyzWmTqglX&q=85&s=bb84010302437fe5fe0423ab877b9fcb" alt="Screenshot of the Header tab of the Properties of SearchElements.InvoiceTable dialog box in ABBYY FlexiLayout Studio, showing Look for header and Header is optional selected with the default search options." width="431" height="455" data-path="images/flexi-capture/fls/tutorial3_26_5.png" />
    </Frame>
  </Step>

  <Step title="Configure the footer">
    Click the **Footer** tab. To detect the footer, use the previously detected `Footer.kwFooter` element: select **Use found element as footer**, click <img src="https://mintcdn.com/abbyy/fmgRWFNHKYN2MLSg/images/flexi-capture/fls/Browse_Button.gif?s=3673db30dda4a3293aec716853588b55" alt="Browse button" style={{display:"inline-block",verticalAlign:"middle",margin:0}} width="21" height="20" data-path="images/flexi-capture/fls/Browse_Button.gif" />, and select the `Footer.kwFooter` element.

    <Frame>
      <img src="https://mintcdn.com/abbyy/8aWHPAJyzWmTqglX/images/flexi-capture/fls/tutorial3_26_6.png?fit=max&auto=format&n=8aWHPAJyzWmTqglX&q=85&s=70b7018b068999171888a3ff75203a36" alt="Screenshot of the Footer tab of the Properties of SearchElements.InvoiceTable dialog box in ABBYY FlexiLayout Studio, with Use found element as footer selected and set to SearchElements.Footer.kwFooter." width="431" height="455" data-path="images/flexi-capture/fls/tutorial3_26_6.png" />
    </Frame>
  </Step>

  <Step title="Set the master columns">
    Click the **Rows** tab. Some columns can have entries of several lines, so specify master columns to detect the rows. Select **Use master columns to detect rows**, click <img src="https://mintcdn.com/abbyy/fmgRWFNHKYN2MLSg/images/flexi-capture/fls/Browse_Button.gif?s=3673db30dda4a3293aec716853588b55" alt="Browse button" style={{display:"inline-block",verticalAlign:"middle",margin:0}} width="21" height="20" data-path="images/flexi-capture/fls/Browse_Button.gif" />, and set the master columns in this priority order:

    * **Total** – The primary column, because it always contains data and one table row corresponds to each entry.
    * **Quantity** – The secondary column, used if FlexiLayout Studio does not detect **Total**.
    * **Unit Price** – The tertiary column, used if it detects neither **Total** nor **Quantity**.

    <Frame>
      <img src="https://mintcdn.com/abbyy/8aWHPAJyzWmTqglX/images/flexi-capture/fls/tutorial3_26_7.png?fit=max&auto=format&n=8aWHPAJyzWmTqglX&q=85&s=444df4f217866eba9a7be6842251d490" alt="Screenshot of the Rows tab of the Properties of SearchElements.InvoiceTable dialog box in ABBYY FlexiLayout Studio, with Use master columns to detect rows selected and Total, Quantity, and UnitPrice listed as the master columns." width="431" height="455" data-path="images/flexi-capture/fls/tutorial3_26_7.png" />
    </Frame>
  </Step>

  <Step title="Constrain the table position">
    Click the **Relations** tab. The sought columns are to the left of the **Sales** column name, with a small gap, so set this constraint:

    * **Left of** the `TableHeader.kwSales` element, **Offset** = -40, **Reference boundary** = **Left**

    <Tip>
      When selecting offset values, analyze the geometrical properties (size and boundaries) of the reference and sought objects detected during pre-recognition. Otherwise, select these values by trial and error.
    </Tip>
  </Step>

  <Step title="Match and check the Quantity column">
    Match the FlexiLayout with the test images. FlexiLayout Studio detects the table element on every image where it occurs. On some images, the **Quantity** column also includes unwanted artifacts from the previous column. To separate the useful data from the noise, specify the type of content the column can contain.
  </Step>

  <Step title="Set the Quantity content type">
    Open the **Properties** dialog box of the **InvoiceTable** element and click the **Columns** tab. Open the **Properties** dialog box for the **Quantity** column, select **Check content type**, and select **Number** in the **Type of column content** drop-down list.

    <Frame>
      <img src="https://mintcdn.com/abbyy/8aWHPAJyzWmTqglX/images/flexi-capture/fls/tutorial3_26_8.png?fit=max&auto=format&n=8aWHPAJyzWmTqglX&q=85&s=f9b88f0e33915159a4be7cddf32467c2" alt="Screenshot of the Properties of column Quantity dialog box in ABBYY FlexiLayout Studio, with the Check content type option selected and Number chosen in the Type of column content drop-down list." width="462" height="377" data-path="images/flexi-capture/fls/tutorial3_26_8.png" />
    </Frame>
  </Step>

  <Step title="Verify the column">
    Match the FlexiLayout with the test images and confirm that the **Quantity** column contains no unwanted data.
  </Step>

  <Step title="Set the block source element">
    To describe the location of the **InvoiceTable** block, select **Source element**, click <img src="https://mintcdn.com/abbyy/fmgRWFNHKYN2MLSg/images/flexi-capture/fls/Browse_Button.gif?s=3673db30dda4a3293aec716853588b55" alt="Browse button" style={{display:"inline-block",verticalAlign:"middle",margin:0}} width="21" height="20" data-path="images/flexi-capture/fls/Browse_Button.gif" />, and specify the **InvoiceTable** element as the source element.
  </Step>
</Steps>
