# Delimited Parser

The *Delimited Parser* in Astera reads and processes a single stream of text in delimited format as input and returns its elements as parsed output. It enables users to transform an otherwise semi-structured data into a structured format.

In this document, we will learn to use the *Delimited Parser* to parse an incoming text stream in Astera.

### Use Case

In this case, we are using the *Delimited File Source* to extract our source data. You can download this sample data from the following link:

{% file src="<https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FbLL8jM1uOd0Utwa2PloM%2FCustomer_Info.zip?alt=media&token=0f41b338-476c-48be-8f84-79aab517c0e3>" %}

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FcEhTcio0cH3iZoZmE96H%2F1_delimited_source.PNG?alt=media\&token=4cd49b58-6f7c-4c17-a105-7b196bb4a355)

The source file contains customers’ contact information including their name, address, postal code, phone number, etc.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FNWkHj5qVxxCagiBPAhC9%2Fsourcedata.gif?alt=media\&token=0c0b39e2-3ed7-45e3-9f06-5061e274fa7e)

Upon previewing the data, you can see that it is difficult to decipher fields and elements since the data is in a single text stream with fields and records separated by delimiters. To make sense of this data, each records needs to be parsed into its elements in respective fields.

To do this, we will use the *Delimited Parser* object.

#### Using Delimited Parser

1. To get the *Delimited Parser* object, go to *Toolbox > Text Processors > Delimited Parser* and drag-and-drop the object onto the designer.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FKCd10dawP97zF3Ijwd42%2Fparser_object.gif?alt=media\&token=fa5f0a0b-cadc-4381-8859-bb739b794b13)

You can see that the dragged object contains a single *Text* field.

2. Map the *Customer\_Info* field inside the source object onto the *Text* field inside *DelimitedParser* object.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FeKAG0Lt9FNYDCNSf1Zm0%2F2_mapping.PNG?alt=media\&token=d93250f4-9604-4892-a913-513a8cc1a6d9)

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

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FCS4WxXK8n6IgMH0iu9YF%2F3_properties.png?alt=media\&token=7827e9f8-cf04-4a7e-b097-4f15214be2f2)

A configuration window will open as shown below.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2Fpr3jZP5gSZKfdB72Hw13%2F4_configuration_window.PNG?alt=media\&token=67dfbfb9-d190-44c6-a7cd-a3bd0c3a0a41)

Let’s look at the properties on this window.

* *Parse Data Pattern* – Contains three patterns in which the dataset can be parsed:

  ![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FAMFJxFc2eHsPArqN4YsQ%2F5_pattern.PNG?alt=media\&token=bd71ff64-9d74-408c-a613-44f00fa27eab)

  * *Single Record* – Data is parsed into a single record with multiple fields. Users need to provide a field delimiter, and a text qualifier, if necessary.
  * *Multiple Records* – Data is parsed into multiple records with a single or multiple fields. Users need to provide a field delimiter as well as a record delimiter.
  * *Field Arrays* – Data is parsed into an array of records and fields. Users need to provide a field value delimiter and an array separator.

The source data in this case contains multiple records with many different fields. Therefore, we will set the *Parse Data Pattern* option to *Multiple Records.*

4. Provide a *Field Delimiter* and a *Record Delimiter*. The source file also contains a *Text Qualifier*.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FStbbNCYV26zCKRqqAuVe%2F6_properties_for.PNG?alt=media\&token=ccf226c1-35eb-485a-8713-9fbfb282017b)

Click *Next.* This is the *Layout Builder* screen.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2Fdmh0UAzw0jR6UxdYGHvi%2F7_layout_builder.PNG?alt=media\&token=e0f0d25e-e2bb-4c95-a68b-cfa9a8ab3917)

5. Here, write the names of the fields that you want to create.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FRBX30ZNKNGzc8LtEm3dS%2F8_creating_fields.PNG?alt=media\&token=df16cabd-8c02-423e-9018-9e65ae467a3a)

Click *OK.* The *Delimited Parser* object now has new fields in the *Output* node.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FLY45MwdPBqEFjD6ucpax%2F11_output_fields.PNG?alt=media\&token=5e65925c-fb56-4d0b-b57d-df113c6d1532)

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

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FsSyr349gGgcVfpKl3dGy%2F9_preview_output.png?alt=media\&token=3e68b8d6-aac1-43bb-9754-22fab8e14c12)

A *Data Preview* window will open. Upon expanding the records, you can view the parsed output.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2F4WnCiZC1wcGr3CG7tGy0%2F10_Data_Preview.PNG?alt=media\&token=03bdd09b-45da-4dab-8323-cfeea0cebb6f)

To store this parsed output, you can write it to a destination file or use it for some transformation further in the dataflow.

This concludes using the *Delimited Parser* in Astera.
