# 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://3891069449-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F28dJIkGHacXhBlux3efx%2Fuploads%2FODCynbWKsrhlDzJbb9sj%2F0.png?alt=media)

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.

## **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. To learn how to load an unstructured document in a report model, click [here](https://documentation.astera.com/astera-data-stack-v9/report-model/user-guide/report-model-tutorial).

![](https://3891069449-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F28dJIkGHacXhBlux3efx%2Fuploads%2F6yXt16mAY8T4yNIkg6Tx%2F1.png?alt=media)

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://3891069449-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F28dJIkGHacXhBlux3efx%2Fuploads%2FmsUsefiJq5dnlwkwa94d%2F2.png?alt=media)

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

**Creating the Report Model**

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

![](https://3891069449-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F28dJIkGHacXhBlux3efx%2Fuploads%2FE2GsYDZN18BaN1eVhX45%2F3.png?alt=media)

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://3891069449-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F28dJIkGHacXhBlux3efx%2Fuploads%2FCug9o4jlOUPwGLsInWUN%2F4.png?alt=media)

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

![](https://3891069449-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F28dJIkGHacXhBlux3efx%2Fuploads%2FB51t4pMQADXXPIUV7f0C%2F5.png?alt=media)

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 that defines the start position of this field.

![](https://3891069449-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F28dJIkGHacXhBlux3efx%2Fuploads%2F5oHbGeWA5HIVf7ORCyYU%2F6.png?alt=media)

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://3891069449-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F28dJIkGHacXhBlux3efx%2Fuploads%2F82afFLJGO06lTXbnu7LL%2F7.png?alt=media)

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

![](https://3891069449-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F28dJIkGHacXhBlux3efx%2Fuploads%2Fkrw4uTEc21i8id35p0Qj%2F8.png?alt=media)

* *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://3891069449-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F28dJIkGHacXhBlux3efx%2Fuploads%2FX4DGfdgnBKW9xE6rA1fI%2F9.png?alt=media)

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://3891069449-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F28dJIkGHacXhBlux3efx%2Fuploads%2FhY2zGwjHWoSbdwd7cQTV%2F10.png?alt=media)

The data is now being captured correctly.

![](https://3891069449-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F28dJIkGHacXhBlux3efx%2Fuploads%2FBERzAjKamrJLf8IjmDO7%2F11.png?alt=media)

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://3891069449-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F28dJIkGHacXhBlux3efx%2Fuploads%2F8TCPMDXg1I0qdUek2R9N%2F12.png?alt=media)

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://3891069449-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F28dJIkGHacXhBlux3efx%2Fuploads%2FXZKwQqweMEqdP5o0amXU%2F13.png?alt=media)

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

![](https://3891069449-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F28dJIkGHacXhBlux3efx%2Fuploads%2FtlfReBsPHehV8qiTDB45%2F14.png?alt=media)

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://3891069449-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F28dJIkGHacXhBlux3efx%2Fuploads%2FKgOM6payFdOU9LX4fpDf%2F15.png?alt=media)

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

![](https://3891069449-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F28dJIkGHacXhBlux3efx%2Fuploads%2FPpKHRY56z0YraWGen8U3%2F16.png?alt=media)

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