# Pattern Count

*Pattern Count* is the number of patterns that Astera matches on your file to capture a data region. This is useful if more than one pattern is required to identify the beginning of your data region. You can specify up to five patterns in a report model at a time.

In this document, we will explore how the *Pattern Count* feature helps with the selection of a data region.

## Loading an Unstructured File

1. Open a *Report Model* in Astera by going to *File > New > Report Model.*

<figure><img src="/files/cGfOc95Y83T2lXwDTlFN" alt=""><figcaption></figcaption></figure>

2. Provide the *File Path* for the unstructured file from your directory.

<figure><img src="/files/4L1Ze9xRqDJ4UUtrjdKL" alt=""><figcaption></figcaption></figure>

Astera supports extraction of unstructured data from Excel, csv, text, PRN, PDF, word, rtf and xls files. In this case, we are extracting data from a text file.

3. Click *Open*. A text file containing information regarding orders to a fictitious furniture store will open in the report model.

<figure><img src="/files/6TvhhdVUbaooDe7bmttw" alt=""><figcaption></figcaption></figure>

Now that the file is open, we will create an extraction template.

## Creating a Report Model

1. Right-click on the *Record* node in Model layout under the *Report Browser* panel and select *Add Data Region* from the context menu.

<figure><img src="/files/F2Fcm3jnlvo3hcS3KP8l" alt=""><figcaption></figcaption></figure>

A pattern-matching bar and *Region Properties* panel will appear. And a subnode "Data" is added to the *Record* node in the Model Layout tab.

<figure><img src="/files/kSxQzRaEUILM14gJ0LPw" alt=""><figcaption></figcaption></figure>

2\. Specify the pattern that the report model can look for and match in your file to capture data. You can use an alphabet, character, number, word, a wild card or any combination of these to define your pattern.

Astera has built-in wild cards to facilitate region selection.

<figure><img src="/files/alQCl0xmfMOYOCyKnPRJ" alt=""><figcaption></figcaption></figure>

<table data-header-hidden><thead><tr><th width="160"></th><th></th></tr></thead><tbody><tr><td><strong>Wild Cards</strong></td><td><strong>Description</strong></td></tr><tr><td><img src="/files/7Ju7oWQhhwL4Mc4iZm6F" alt="image-20230817141841200"></td><td>It matches any alphabet on the file.</td></tr><tr><td><img src="/files/ZqNJ1tD0sr1UP4UzCjRf" alt="image-20230817141916923"></td><td>It matches any digit on the file.</td></tr><tr><td><img src="/files/UB6WZfMT8C5MgGDYFwaI" alt="image-20230817141956380"></td><td>It matches any alphabet or digit on the file.</td></tr><tr><td><img src="/files/Z4jbyKmtZoHYfqo45xZq" alt="image-20230817142024140"></td><td>It matches any non-blank character on the file.</td></tr><tr><td><img src="/files/bYVcV22FLxg7JBi2B4KE" alt="image-20230817142046770"></td><td>It matches any blank character such as line, space, tab etc. on the file.</td></tr></tbody></table>

In this example, we want to capture the data highlighted in yellow. Notice that each item has a specific item code, which we can use as a pattern to extract all the item details.

<figure><img src="/files/1hGhCD4ZGK8kxJvLmNPT" alt=""><figcaption></figcaption></figure>

3\. The pattern is a combination of three alphabets, a hyphen, and five digits. You can use the relevant wildcards to specify the pattern. In this case, notice that some item-codes are different from this pattern. The digits in the codes appear before the alphabets. As a result, RUGS has not been captured in the data region.

<figure><img src="/files/9tPhsJBdQ2HkhOykf0oH" alt=""><figcaption></figcaption></figure>

4\. In this scenario, to capture the region completely, we'll specify another pattern. You can specify up to five patterns in a single data region. We'll go to the Pattern Properties panel and increase the Pattern Count to 2. Another pattern bar appears.

<figure><img src="/files/LqNUhXITWDQ20VUcPoeW" alt=""><figcaption></figcaption></figure>

5\. On the second pattern bar, we'll specify another pattern where the 5 digits come before the 3 alphabets, separated by a hyphen. Now, all the lines with item details have been captured completely in the data region.

<figure><img src="/files/vvhjq66exQajgXbY6cOk" alt=""><figcaption></figcaption></figure>

6\. Once our data region is defined, the next step is to create data fields. To do that, you can highlight each field area, right-click and select *Add Data Field.*

<figure><img src="/files/VfctA2oMZ23ASN7vHgYy" alt=""><figcaption></figcaption></figure>

7\. Repeat the process to create more data fields and name them as shown below.

<figure><img src="/files/P2gVlmyg3lgliaECRDPK" alt=""><figcaption></figcaption></figure>

8\. Preview data by clicking on the *Preview Data* icon placed in the toolbar at the top of the designer window.

<figure><img src="/files/qT7PcARm4XXZ3o0PWPMd" alt=""><figcaption></figcaption></figure>

9\. A window will open, asking you to save the file before proceeding. Save the report model at your required path.

<figure><img src="/files/pEMDjo1SAvMCN9pFN1tb" alt=""><figcaption></figcaption></figure>

10\. Once saved, a *Data Preview* window will open, displaying a preview of the extracted data.

<figure><img src="/files/9QuhNwOrn3gEJzvnarr1" alt=""><figcaption></figcaption></figure>

This concludes our discussion on working with an increased *Pattern Count* in Astera.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://documentation.astera.com/report-model/use-cases/pattern-count.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
