# 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-v8/dataflows/sources/database-table-source).

<figure><img src="https://750977703-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqHxyVNGb7tSdIWecl6Ru%2Fuploads%2F8p7gdrFZbHgUMr9ikCwu%2Fimage.png?alt=media&#x26;token=f1ba0935-e8ed-4ba7-8e68-0ae17011557b" alt=""><figcaption></figcaption></figure>

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.

<figure><img src="https://750977703-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqHxyVNGb7tSdIWecl6Ru%2Fuploads%2FGdGs7rzoRk4AZKGiJYBI%2Fimage.png?alt=media&#x26;token=a4126186-c0da-4a25-811d-993a81d66407" alt=""><figcaption></figcaption></figure>

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

<figure><img src="https://750977703-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqHxyVNGb7tSdIWecl6Ru%2Fuploads%2FMepaVpLmRq88XJReQ5gw%2Fimage.png?alt=media&#x26;token=370c1d5e-f3fb-436b-a51a-fcd27394e4df" alt=""><figcaption></figcaption></figure>

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.

<figure><img src="https://750977703-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqHxyVNGb7tSdIWecl6Ru%2Fuploads%2FR3nsozMOQRHoZCUpySx6%2Fimage.png?alt=media&#x26;token=d89aebbc-7b45-4375-80ba-e8148e5b5f44" alt=""><figcaption></figcaption></figure>

{% 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.

<figure><img src="https://750977703-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqHxyVNGb7tSdIWecl6Ru%2Fuploads%2Fm8MvPOsj8dXXNgnC0QqO%2Fimage.png?alt=media&#x26;token=465017c3-2c29-43c9-8dce-ffbfed36c5bf" alt=""><figcaption></figcaption></figure>

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.

<figure><img src="https://750977703-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqHxyVNGb7tSdIWecl6Ru%2Fuploads%2FfZzeqf4mqWSH6tFaqPxl%2Fimage.png?alt=media&#x26;token=5f6e79fb-c27a-4fdd-a8e2-1407a0044ec4" alt=""><figcaption></figcaption></figure>

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

<figure><img src="https://750977703-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqHxyVNGb7tSdIWecl6Ru%2Fuploads%2F9Z9fxSigakQDPOT02vYF%2Fimage.png?alt=media&#x26;token=28b2ef6d-2f6f-477c-869c-98b125069bc9" alt=""><figcaption></figcaption></figure>

*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.*

<figure><img src="https://750977703-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqHxyVNGb7tSdIWecl6Ru%2Fuploads%2FQ1T0w0vkK41r294YXaY2%2Fimage.png?alt=media&#x26;token=c936c713-c1db-4d17-ac5e-136e19be432c" alt=""><figcaption></figcaption></figure>

Click *OK*.

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

<figure><img src="https://750977703-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqHxyVNGb7tSdIWecl6Ru%2Fuploads%2FtawvsSRRI1CObMtnpyUi%2Fimage.png?alt=media&#x26;token=b69b4387-0624-4ccc-ab71-59ae7c35672e" alt=""><figcaption></figcaption></figure>

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

<figure><img src="https://750977703-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqHxyVNGb7tSdIWecl6Ru%2Fuploads%2FmYCXa5bj5nDnljbLOw2M%2Fimage.png?alt=media&#x26;token=ccb0777c-bca1-41b4-b51b-05ef963a2a27" alt=""><figcaption></figcaption></figure>

## **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.

<figure><img src="https://750977703-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqHxyVNGb7tSdIWecl6Ru%2Fuploads%2Fx2Iey72Bn5GOW0SKzh4O%2Fimage.png?alt=media&#x26;token=dae49330-1b26-4df5-bd7b-2572f156e3a9" alt=""><figcaption></figcaption></figure>

We can write these statistical measures to a destination file.

1. Right-click on the *Output* node and go to *Write To > Delimited File Destination*.

<figure><img src="https://750977703-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqHxyVNGb7tSdIWecl6Ru%2Fuploads%2F26sVpZJavqtcMrOC4FsM%2Fimage.png?alt=media&#x26;token=c6b2b350-adcf-4039-84f5-8eb0cfdca241" alt=""><figcaption></figcaption></figure>

A *Delimited File Destination* object will be added to the dataflow designer with auto-mapped fields from the *Output* node.

<figure><img src="https://750977703-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqHxyVNGb7tSdIWecl6Ru%2Fuploads%2FgeJ1Zk4ITo9YWrEOKLaA%2Fimage.png?alt=media&#x26;token=10c13737-61bc-4231-b6bb-f2a27a87ba17" alt=""><figcaption></figcaption></figure>

2. Configure settings for your [*Delimited File Destination*](https://documentation.astera.com/v/astera-data-stack-v8/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://750977703-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqHxyVNGb7tSdIWecl6Ru%2Fuploads%2F2sjGfnJn8DKr3hr5TwzO%2Fimage.png?alt=media\&token=8a94001c-11e3-4dea-af05-51e9d0e00370)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.

<figure><img src="https://750977703-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqHxyVNGb7tSdIWecl6Ru%2Fuploads%2FvDS79anya9ljwYt4aKvY%2Fimage.png?alt=media&#x26;token=8c8efbde-2eca-480e-815e-f48af5f91d2f" alt=""><figcaption></figcaption></figure>

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