# Fixed Length Serializer

*Fixed Length Serializer* is useful when source data is stored in multiple fields and is to be converted to text format (store entire data in a single field). This is helpful in scenarios where you have to:

* Store large datasets, so you compress the information in a single field
* Transport volumes of data over a network

**Sample Use-Case**

In this case, we are using an [*Excel Workbook Source*](https://documentation.astera.com/astera-data-stack-v9/dataflows/sources/excel-workbook-source).

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

The source file contains customers’ *ContactDetails*.

To preview this data, right-click on the source object’s header, and select *Preview Output* from the context menu.

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

A *Data Preview* window will open, displaying the source data.

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

Now, we want to convert the information contained in multiple fields into a single field in text format.

**Using Fixed Length Serializer**

1. To get the *Fixed Length Serializer* object, go to *Toolbox > Text Processors > Fixed Length Serializer*, and drag and drop the object onto the designer.

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

You can see that the dragged-object contains a *Text* field and an *Input* sub-node which is currently empty.

2. Auto-map the source fields by dragging and dropping the top node of the source object, *ContactDetails*, onto the *Input* node of the *Fixed Length Serializer* transformation object.

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

3. Right-click on the object’s header and select *Properties*.

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

A configuration window will open, as shown below.

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

4. Check the options according to the contents and format of your source file.

In this example, both options have been checked, as the first row in the source file contains a header, and the data also contains multiple records.

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

5. Specify the *Record Delimiter* of the source data. In this case, it is <*CR*><*LF*>.

You can specify any delimiter based on the format of your source file.

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

6. Under the *Builder Options*, select the relevant type from the drop-down list. For this dataset, we will use *One Record Per Input*.

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

7. Click *Next*. This will open the *Destination Fields* screen, where you can see all the incoming fields from the source object.

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

Here you can delete fields, change their *Header* or *Data Type*, modify the string’s *Start Position*, define field *Length*, and customize the fields according to your requirements.

Click *OK*.

8. Right-click on the *Fixed Length Serializer* object, and select *Preview Output*.

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

A *Data Preview* window will open, displaying the serialized data.

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

To store this serialized output, write it to a destination file.

### **Writing to a Destination**

1. Right-click on the *FixedLengthSerializer* node and go to *Write to > Fixed Length File Destination*. A *Fixed Length File Destination* object is added to the dataflow designer with a *Text* field automapped to it.

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

2. Configure settings for the [*Fixed Length File Destination*](https://documentation.astera.com/astera-data-stack-v9/dataflows/destinations/fixed-length-file-destination) object.
3. Click on the *Start Dataflow* icon, located in the toolbar at the top, to create the destination file.

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

A *Fixed Length File Destination* file will successfully be created. You can find its link in the *Job progress* window.
