# Creating Field Profile

The *Field Profile* feature captures statistics for selected fields from one or several objects. *Field Profile* is essentially a transformation object as it provides Input and Output ports similar to other transformations.

These output ports make it possible to feed the statistics collected to another object on the dataflow.

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

## **Using Field Profile**

In this case, we have extracted data from a sample *Invoices* [*Database Table Source*](https://documentation.astera.com/v/astera-data-stack-v7/dataflows/sources/database-table-source).

![](https://627607815-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6xzBT0roYJkfVS5klkLl%2Fuploads%2FPOQi3llgWCLwBvfprXYU%2F0.png?alt=media)

We want to collect detailed statistics from some of these fields of data and write them to a *Delimited File Destination*. For this purpose, we will use Astera's *Field Profile* feature.

1. To get a *Field Profile* object from the Toolbox, go to *Toolbox > Data Profiling > Field Profile*. If you are unable to see the toolbox, go to *View > Toolbox* or press Ctrl + Alt + X.

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

2. Drag and drop the *Field Profile* object onto the dataflow designer.

![](https://627607815-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6xzBT0roYJkfVS5klkLl%2Fuploads%2F4wq6RVUPScGhpefnBYz9%2F2.png?alt=media)

You can see that the dragged *Field Profile* object contains an *Input* node and an *Output* node. The *Input* node is empty as we have not mapped any fields to it yet.

3. One-by-one map *ShipName, CustomerID, Country, OrderDate, ProductName, UnitPrice,* and *Quantity* from the source object to the *Field Profile* object’s *Input* node.

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

{% hint style="info" %}
**Note:** Statistics will be collected only for the fields linked to the *Input* node of the *Field Profile* object. This way, you can selectively collect statistics for a subset of fields from the selected field layout.
{% endhint %}

## **Configuring the Field Profile Object**

1. To configure the *Field Profile* object, right-click on its header and select *Properties* from the context menu.

![](https://627607815-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6xzBT0roYJkfVS5klkLl%2Fuploads%2FzWZpugUgrRSRDDf25y6M%2F4.png?alt=media)

A configuration window will open. On the first screen, you will see the *Layout Builder*. This is where we can create or delete fields, and change their name, and data type.

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

2. Click *Next*. On the *Properties* window, specify the *Statistics Type* from the dropdown list.

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

*The Field Statistics* dropdown allows you to select detailed levels of statistics to collect. Select among the following detail levels:

* *Basic Statistics*: This is the default mode. It captures the most common statistical measures for the field’s data type.
* *No Statistics*: No statistics are captured by the *Data Profile*.
* *Detailed Statistics – Case Sensitive Comparison*: Additional statistical measures are captured by the *Data Profile*, for example, Mean, Mode, Median, etc. using case-sensitive comparison for strings.
* *Detailed Statistics – Case-Insensitive Comparison*: Additional statistics are captured by the *Data Profile*, using case-insensitive comparison for strings.

In this case, we will select *Detailed Statistics – Case Sensitive Comparison.*

![](https://627607815-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6xzBT0roYJkfVS5klkLl%2Fuploads%2FC8FpNkcB3FVA4FzyZMts%2F7.png?alt=media)

Click *OK*.

3. Right-click on the *Field Profile* object’s header and select *Preview Output* from the context menu.

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

A *Data Preview* window will open and show you the statistics of each mapped field as a record.

![](https://627607815-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6xzBT0roYJkfVS5klkLl%2Fuploads%2FuE4hHAscxAhSKhcrB3Ou%2F9.png?alt=media)

## **Writing to a Destination**

Observe that the *Field Profile* object contains an *Output* node. Once expanded, you will see various statistical measures as fields with output ports.

![](https://627607815-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6xzBT0roYJkfVS5klkLl%2Fuploads%2FUTKvKO1doDjTit2UNGub%2F10.png?alt=media)

We can write these statistical measures to a destination file.

1. Drag-and-drop *Delimited File Destination* onto the dataflow designer by going to *Toolbox > Destinations > Delimited File Destination*.

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

2. Auto-map all fields, under the output node of the *FieldProfile* object, to the *DelimitedDestination* object.

![](https://627607815-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6xzBT0roYJkfVS5klkLl%2Fuploads%2FjARNeU1oi5DeKA2fmFso%2F12.png?alt=media)

3. Configure settings for your [*Delimited File Destination*](https://documentation.astera.com/v/astera-data-stack-v7/dataflows/destinations/delimited-file-destination).

## **Executing the Task**

1. After configuring the settings for the *Delimited File Destination* object, click on the *Start Dataflow* icon ![](https://627607815-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6xzBT0roYJkfVS5klkLl%2Fuploads%2FmWj63gyj1ONg2YKoT04e%2F13.png?alt=media)from the toolbar located at the top of the window.

A *Job Progress* window will open at this instant and will show you the trace of the job.

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

You can open the delimited file that contains field statistics from the link provided in the *Job Progress* window.
