# Using Auto Generation Layout, Auto Create Fields and Auto Create Table (Preview)

Astera’s AI capture process is the first step towards innovation in the traditional pattern-based template extraction via Artificial Intelligence. The *Auto-Generate Layout* feature lets you auto-create all the data regions and data fields with the click of a button. This feature helps save time and effort spent on manually creating a report model from scratch, making the entire extraction process quicker and more efficient.

The algorithm first identifies the tables and key-value pairs in the document and sends their meta-data to the report designer in Astera. Information from this detection process is then reverse engineered to create a model layout. It is important to note here that this feature is a design-time convenience to jump-start the extraction process. Users can then fine-tune/tweak the layout which has been created automatically to fit their business requirements.

AGL comes with two sub-components called *Auto-Create Fields (Single Instance)* and *Auto Create Table*. These drag-and-click options enable the user to create selected fields and selected tables respectively. In this article, we will see how we can use the AGL feature to create an extraction template within seconds and modify it using its sub-components.

{% embed url="<https://youtu.be/GgAieg2CP3M>" %}

### Sample Use-Case

In this case, we have a PDF invoice for Lumos State Solutions opened in a report model.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2Fx0AI4m9HzgrhsvdoeJ6G%2F01-use-case.PNG?alt=media\&token=55742d9d-fbbd-4cf8-a51f-dd1505d06153)

As we can see, the invoice contains some name value pairs at the top, followed by a table below it.

Notice that the name value pairs are separated by colons and the headers of the table are all in one line. This is an ideal file to extract data from using the *Auto-Generate Layout* option.

### Steps to Auto-Generate Layout

1. First, we need to create a report model. Go to *File > New* and select *Report Model.*

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FQzxkD5YdM2yur4m3mhj7%2F02-report-model.png?alt=media\&token=5b69fd8c-260d-4206-a4e1-a1be9b7b2b28)

2. A pop-up window will open, asking you to specify the path of the source file you want to extract data from. Locate the directory containing the source file, select the file, and click *Open.*

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FTN7FdE9wAw4v6pO0EI63%2Fopen-file.png?alt=media\&token=9f99a01b-209c-4c3f-b53a-110398a7e0f7)

3. You can now see the source file on the report designer. Click on the *Auto Generate Layout* option present in the toolbar to auto-create a layout.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2F4FXkErIwK3laJjRHncoS%2F03-agl.png?alt=media\&token=f606c932-114c-4fe4-ac37-5a7a2fca8edf)

4. A *Progress* window will pop-up, showing the status of the process. You can stop the process by clicking on *Cancel*, if you wish. For now, wait for a few seconds.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FuzPyOuD9i4L602XH5AGy%2F04-progress.PNG?alt=media\&token=170df284-7a4d-4f54-9291-da67f97b5f4c)

5. An *Output* window will appear at the bottom, showing the details of the regions extracted from the unstructured invoice.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FPwmJKhwiXsSp9plMvTRH%2F05-output.PNG?alt=media\&token=17abe634-e466-47d9-9e04-da790df8d564)

Notice that it only took roughly 5 seconds to generate this layout, which is much faster than manually creating the layout from scratch.

6. The Model Layout panel shows the regions and data fields extracted in this report model. The *Data* node contains name-value pairs, whereas the *Table* region contains the information stored in the table.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FfXsvSQ1OmYELQWL90IcE%2F06-model-layout.PNG?alt=media\&token=5295f215-f537-4dfc-8b42-d26b98e73524)

7. The *Data\_1* node contains only one field, *Total.* Since we do not want to extract that information in this use-case, let’s delete that region. Right-click on the node and select *Delete Region* from the context menu.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FkSKOyp4ha0br0w1Zx58W%2F07-delete-region.png?alt=media\&token=070f7725-2b4e-4fe2-a1de-17e9707e5c4e)

8. The *Bill Address* field has not been captured correctly.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FXyUZVbG9GFJVfBdbMH7o%2F08-address.gif?alt=media\&token=612e3a25-893e-43b5-a6b8-2ea2f3e13f99)

We can fix this by deleting extra fields *(Bill\_Address\_TX* and *Ash*) and increasing the length of the field in the Field Properties panel.

### Auto Create Fields (Single-Instance)

However, not all the information has been captured in the name-value data region. Some lines with useful information (line 20-21) are not even the part of the data region (highlighted in grey). This is because the key-value pairs with no separator in between were not captured by the AGL algorithm. You may refer to the Best Practices section in the [UI walkthrough document](https://documentation.astera.com/astera-data-stack-v10/report-model/auto-generate-layout/ui-walkthrough-auto-generation-of-layout-fields-and-table) to understand how to get the most accurate results using the AGL feature.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FV6l4wT7CNIoZpaicqGU4%2F09-ACF.png?alt=media\&token=9a46c821-60c2-47f3-ac9a-5e2731ea995d)

1. To fix this issue, we can increase the *Line Count* of the region in the Region Properties panel.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FJHgzIXMg6WELTiJXxOkM%2F10-line-count.png?alt=media\&token=f1d695a7-103a-4307-af97-2b8bc6b16b55)

2\.

a. To capture *Sales Order* and *Packing Slip* fields, select the data on the designer, right-click on the designer, and select the \*Auto Create Field (Single-Instance) option from the context menu.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FlV0N0s5e3GXxlKPBm4cU%2F11-acf.png?alt=media\&token=a29ead94-83d6-4a49-9cad-5e105241c8b5)

b. Alternatively, after selecting the data, you may click on the *Auto Create Fields (Single-Instance) (Beta)* option in the Region Properties panel.

Notice that there is another option, *Auto Create Fields (Collection),* in the Region Properties panel. You do not have to select the data on the designer to use the latter, this is how the two options differ in usability.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2F5DNh88VF5D12GUGy94lK%2F12-acf.png?alt=media\&token=7853c136-d4c3-433c-833a-26d7a11ae910)

{% hint style="info" %}
**Note:** Make sure the correct region is selected while using this option.
{% endhint %}

3. An *Output* window will open showing the status of the process.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FTMkwxYVd3bqZoQxIVF7g%2F13-output.PNG?alt=media\&token=5a757c8b-0289-4192-9bb4-af8d079fe95a)

4. We can check the Model Layout panel to see if two new fields have been created.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FJCK9m0UmT9HfVjkmIKJX%2F14-fields-model.png?alt=media\&token=a2b5bc23-52bf-4d0a-861a-235a5f7749c5)

5. You can also preview the data using the *Preview Data* option from the toolbar. A *Data Preview* window will open showing the extracted regions and fields.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2ForSPXZ1fvE1httPCQSjt%2F14-2-preview.png?alt=media\&token=5225c417-66a9-420a-bee7-666ca2d3cb77)

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FCpdylumC2W0kIV36HW3D%2F14-3-data.PNG?alt=media\&token=76d59bf5-5bf2-45b9-bd39-aa9ab2ca830f)

### Auto Create Table (Preview)

In case you want to extract the table only from the unstructured document, you can use the *Auto Generate Table* option.

1. Select the complete data which is a part of the table region. Make sure the first line of the selection contains the headers of the table.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FNZpa06mawmRYaC8OuERD%2F15-table-selection.PNG?alt=media\&token=f43e6d3d-7070-4200-9306-61e4a0a0c2d8)

{% hint style="info" %}
**Note:** For best results, the headers must all be in one line. If they are not, you may have to specify the number of rows the header spans over in the Region Properties panel.
{% endhint %}

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FPCAtaSyGSqE7AXGryT2S%2F19-header-span.png?alt=media\&token=df234649-9f6a-46e8-baf0-a23d19b0bd8e)

{% hint style="info" %}
**Note:** In case the data for a record spans over multiple lines, increase the region line count and field height from the Region Properties and Field Properties panels.
{% endhint %}

2. Right-click on the designer and select the *Auto Create Table* option from the context menu.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FarTmjekBSk4jrb0WLYIx%2F16-agt.png?alt=media\&token=2088fc3b-525b-4df3-b046-9fae4232a5c6)

3. Again, a *Progress* window will show the progress of the operation and the *Output* window will show the status of the newly created table region.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2Ft4IoW79wYMbcNw11tZDw%2F04-progress.PNG?alt=media\&token=8e67f91c-ab65-43c2-9c4a-fda5832cef59)

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FGz4z5eEgdYFmYBT8uLag%2F17-output.PNG?alt=media\&token=dc5a5ffb-ab3f-4d4f-bff9-e6088563e415)

4. You can see all the fields created in the table region in the Model Layout panel.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FqMBhjbC3Kpk2pFE0vBu7%2F18-model.PNG?alt=media\&token=4e06fea3-9ced-40cc-92a5-9d98b78f30c8)

This concludes the discussion on the auto generate layout, fields and table features in Astera.<br>
