# Defining the Start Position of Data Fields

*Start Position* options are useful for defining the start position of a selected data field. They appear in the *Size and Position* group-box in the Field Properties panel. There are three options available in the drop-down menu of the *Start Position* option:

1\. *Fixed*

2\. *Follows String in Current Line*

3\. *Follows String in Previous Line*

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FdYvr1LZHgbR8SBXfFZcQ%2FStart-Position_0.png?alt=media\&token=31d444d6-7f6a-4d51-9eea-149cc4a5184f)

In this document, we will discuss how to work with the *Follows String In Current Line* and *Follows String In Previous Line* options to define the start position of a data field.

{% embed url="<https://youtu.be/3C-Y5BPSnAA>" %}

### Loading An Unstructured File

Before creating an extraction template, we need to import the unstructured source file that we want to extract data from in Astera.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FIAzzsTjXsCAepRpovGay%2FStart-Position_1.PNG?alt=media\&token=d42f353b-909b-4be8-a463-48b2c33ce817)

The Report Options panel provides the configuration options for loading the unstructured file. You can change the source file by specifying its *Path* in the *Data File Location* group-box.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FBRWN6Uoe32CTg2T9bX49%2FStart-Position_2.PNG?alt=media\&token=dc75f08c-786e-441b-8e38-137d1f760911)

There are also some other configuration options. To learn more about the Report Options, click [here](https://documentation.astera.com/astera-data-stack-v10/report-model/report-model-interface/report-options).

### Creating the Report Model

Add a new [data region](https://documentation.astera.com/astera-data-stack-v10/report-model/report-model-interface/data-regions-in-report-models) and [specify an appropriate pattern](https://documentation.astera.com/astera-data-stack-v10/report-model/use-cases/applying-pattern-to-line) to capture all the lines in that region.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FbP74uoYR2QhxLK4LOmo2%2FStart-Position_3.PNG?alt=media\&token=2797a018-4711-4fee-9ba3-d3498e5d3aac)

Here, we have defined the pattern as ‘ACCOUNT:’ and the *Region End Type* is set to *Another Region Starts*, which means that the current data region will end when another one starts.

### Using Start Position Options to Capture Data Fields

We have captured the data region of our interest in the report model. Let’s extract relevant data points by *Adding Data Fields.*

1\. To create the data field, highlight the desired field area, right-click on it and select the *Add Data Field* option from the context menu.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FYJPj0xKghgfVG8W8CKfo%2FStart-Position_4.png?alt=media\&token=880d41b9-a17d-4beb-b219-2005ff831ab0)

2\. As you can see below, the data is misaligned and therefore is not being captured correctly.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FR9lO8r8xQKVUwuJrIrVh%2FStart-Position_5.PNG?alt=media\&token=3be6be66-6971-4f99-912f-c5055a9cb71e)

3\. To solve this problem, we can use the *Follows String in Current Line* option from the *Start Position* drop-down menu in the Field Properties panel to specify a string which defines the start position of this field.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2F6YGpVWXnkZ1KitlTSMzl%2FStart-Position_6.PNG?alt=media\&token=42575c7e-e210-46bb-9f65-5d03cf393a62)

Here, we have defined ‘contact:’ as the string in the textbox and *Length Till End Of Line* to define the start position. Now, all the data points in this field have been captured completely.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FNm2CY2hFxKEZpxmd7idR%2FStart-Position_7.PNG?alt=media\&token=f41881ae-ef0b-49b1-b247-347650b855a6)

4\. Notice that two checkboxes, *Case Sensitive* and *Regular Expression,* have appeared in the Field Properties panel.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2F0HlmLZyfYxuhRavdrhSv%2FStart-Position_8.PNG?alt=media\&token=ab6648b9-7632-4ec2-bba9-baad3ff6d8c7)

*Case Sensitive:* Allows users to search the specified string on a case sensitive basis.

*Regular Expression:* Allows users to use a regular expression to search the preceding string of the data field.

5\. Let’s go ahead and select the *Case Sensitive* option and see what happens.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FZradVVass9fEXTyhpW2W%2FStart-Position_9.PNG?alt=media\&token=8e56ae03-08d6-4313-8997-64098e93b306)

The fields are no longer being captured as they are no longer highlighted in blue. This is due to the case sensitive comparison of the two strings ‘CONTACT:’ and ‘contact:’ (they are currently not matching due to the difference in upper and lower cases). Uncheck the *Case Sensitive* option.

6\. Select the *Regular Expression* checkbox and define a regular expression in the textbox to capture the data points.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FWSw3ukTYuoUyPzsxURm2%2FStart-Position_10.PNG?alt=media\&token=dba1492b-3cb1-423c-8e79-3ef6b26626cd)

The data is now being captured correctly.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FQ84719IgC2hp4WCz8Nbm%2FStart-Position_11.PNG?alt=media\&token=ba313da5-1235-4622-94d7-77eef2daaea4)

7\. Next, capture the data points for the field, *Address*. This time, define the *Start Position* as *Follows String in Previous Line* as the address starts from the following line of the string ‘ADDRESS:’.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2Fe1BRNujVD7hcGme863g3%2FStart-Position_12.PNG?alt=media\&token=e35c9e9f-e55c-44e8-830c-8feb9889ef4f)

Notice that we have matched the case of the string specified in the textbox with the case of the string in the document since the *Case Sensitive* checkbox is selected. Therefore, the data is being captured correctly.

8\. Lastly, capture the data in the field *Account*, by using the *Follows String in Current Line* option.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2Fb1FRhoaH7t3Gf51NNCmf%2FStart-Position_13.PNG?alt=media\&token=5c8cb0f8-fd8f-4c38-b2ed-7d2fa310829f)

9\. You can rename the fields in the *General* section of the Field Properties panel. This is what our Model Layout looks like:

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FR0DtZ9D5S3TGaV2tJVhm%2FStart-Position_14.PNG?alt=media\&token=370c30d2-5ba5-4b33-9391-067c855c55f5)

10\. Preview the data by clicking on the *Preview Data* icon to check if all the fields are being extracted correctly from the unstructured document.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FboNUQDk9loEcvdCm6z7B%2FStart-Position_15.png?alt=media\&token=55a80bee-1607-4d6f-a6ce-90c77634f303)

The *Data Preview* window shows the data extracted from the unstructured document.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2F41Eq4Au7CXKI19dnSpuw%2FStart-Position_16.PNG?alt=media\&token=f3862936-2607-4ceb-9e88-96b8f2b8e332)

This is how we can extract data from an unstructured file by specifying *Start Position* options in Astera.
