# Fixed Length File Destination

Astera’s *Fixed Length File Destination* provides the functionality to write data to a Fixed Length File.

### Video

{% embed url="<https://www.youtube.com/watch?v=h0FlMGgtiko>" %}

### Configuring the Fixed Length File Destination Object

* To get a *Fixed Length File Destination* object from the Toolbox, go to *Toolbox > Destinations > Fixed Length File Destination*. If you are unable to see the Toolbox, go to *View > Toolbox* or press Ctrl + Alt + X.

![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/dRhmbSI1M4ccySVp8GLO/1.png)

* Drag-and-drop the *Fixed Length File Destination* object onto the designer.

![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/fnVM4VrJEjWNxhdRNJn9/2.png)

The dragged destination object is empty right now. This is because the object has not been configured yet.

#### Mapping

For the *Fixed Length File Destination* object to work, it needs to be provided with a data source.

* Configure the source object and place it onto the designer next to the *Fixed Length File Destination* object.

{% hint style="info" %}
**Note:** In this case we will be using a *Customers* sample table from the *Database Table Source* to write to the *Fixed Length File Destination*.
{% endhint %}

![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/K2JxiTdSG1Ouo3PsIi4E/3.png)

* Now map the source object to the destination object. The following ways can be used for mapping:

  i. By dragging and dropping the parent nodes onto each other for automatic mapping.

![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/7AMlIR8oUR7tCwkuaSUT/4.png)

ii. By mapping the source parent node by dragging it to the destination parent node manually.

![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/NZL6arytyJSbLrdaUGQ5/5.png)

iii. By directly writing the source layout to a Fixed Length File Destination through the source context menu of its parent node.

![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/aV5jCkFw7UIrPNpKsIoy/6.png)

* The fields are now mapped.

![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/lhrxSdV0nnvOEA6mkNeC/7.png)

#### Configuration

1. To configure the *Fixed Length File Destination* object, right-click on the header, select *Properties* from the context menu, and a dialogue box will open.

![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/Tvp937q8Q0tttNVAwGKu/8.png)

![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/btuLNlZQgLK18lLH1m0H/9.png)

2. Provide the *File Path*. This is where the fixed length destination file will be saved.

![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/gQImZLcf9dO7eJd38Pb7/10.png)

3. The dialog box has some other configuration options. Let’s go over these options:

* *Options:*

  ![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/mpUvKdhRYQV1LUQHv7tP/11.png)

  * If the *First Row Contains Header*, check the box to read headers from the source file.
  * *Record Delimiter* - Allows you to select the delimiter for the records in the fields. The choices available are *carriage-return line-feed* combination, *carriage-return* and *line-feed*. The record delimiter can also be of choice, instead of choosing from the available options.
  * In case the records don’t have a delimiter, the *Record Length* field is used to specify the character length for a single record.
  * *Encoding* - Allows you to choose the encoding scheme for the delimited file from a list of choices. The default value is *Unicode (UTF-8)*
  * Choose *Append to File (If Exists)* to append to an existing file or create a new file. Creating a new file will overwrite any existing file.
  * Check the *Write to Multiple Files* option for the data to be saved to multiple files instead of one single file. This can be done within a single dataflow through the destination object and supporting transformations.
  * To define hierarchical file layout and process the data file as a hierarchical file check the *This is a Hierarchical File* option. Astera IDE provides extensive user interface capabilities for processing hierarchical structures.

4. Once the data reading options have been specified on this window, click *Next*.

![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/7CrOZYkkyecsEnPNmWDa/12.png)

The next window is the *Layout Builder*. On this window, the layout of the fixed length destination file can be modified.

![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/BRDMZn8n1Dvt2q9GKIfy/13.png)

* To add a new field to the layout, go to the last row of the layout (Name column), which will be blank and double-click on it, and a blinking text cursor will appear. Type in the name of the field to be added and select the subsequent properties for it. A new field will be added to the source layout.

![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/A7Y3FIWWCA94KYalHkRg/14.png)

{% hint style="info" %}
**Note:** Adding a new field *(Email)* to the layout.
{% endhint %}

* To delete a field from the layout, click on the serial column of the row that is to be deleted. The selected row will be highlighted in blue.

![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/6gdnGHplhT7sDiK8Rnh6/15.png)

{% hint style="info" %}
**Note**: Deleting the *Fax* field from the layout.
{% endhint %}

* Right-click on the highlighted line, a context menu will appear which will have the option to *Delete*.

![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/SEdqhePMro6f2xYLJ4fL/16.png)

Selecting *Delete* will delete the entire row.

![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/HvIdqc74Z0OyN50dg84f/17.png)

The field is now deleted from the layout and won’t appear in the output.

* To change the position of any field and move it below or above another field in the layout, select the row and use Move up/Move down keys.

{% hint style="info" %}
**Note**: Find the Move up/Move down icons on the top left of the builder.
{% endhint %}

![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/hgAwC9seOm0ZnU8CnsuA/18.png)

For example: To move the *Country* field right below the *Region* field, select the row and use the Move up key to from the 9th row to the 8th row.

![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/oeahBowPAStUghyC29mO/19.png)

The row is now moved from the 9th position to the 8th position.

![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/VNUnPRI1mtnLgPUxDxu3/20.png)

5. Once the object layout is configured, click *Next*. A new window will appear, *Config Parameters*, which allows to further configure and define parameters for the fixed length destination file.

Parameters can provide easier deployment of flows by eliminating hardcoded values and provide an easier way of changing multiple configurations with a simple value change.

{% hint style="info" %}
**Note**: Parameters left blank will use their default values assigned on the properties page.
{% endhint %}

![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/zAbn242rryDP2YlCQyil/21.png)

6. A *General Options* window will appear. On this window:

* *Comments* can be added.
* *General Options* are given, which relate to processing of records in the destination file.

![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/hVfjJWXfYuB3vqKwMSjw/22.png)

7. Click *OK.*

![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/qMzBuY7XJOlCNmuSwFhY/23.png)

The *FixedDest* object is now configured according to the changes that were made in the properties window.

{% hint style="info" %}
**Note**: The changes that were made in this case are:

* Added a new field, *Email* in the layout.
* Moved the *Country* field below the *Region* field.
  {% endhint %}

![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/tHhqrXar82uRmlm1Y7Yb/24.png)

The *Fixed Length File Destination* object is successfully configured, and the destination file can now be created by running the dataflow.
