Delimited Parser¶
The Delimited Parser in Astera Centerprise 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 Centerprise.
Use Case¶
In this case, we are using the Delimited File Source to extract our source data. You can download this sample data from here.
The source file contains customers’ contact information including their name, address, postal code, phone number, etc.
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 that, 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.
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.
3. Right-click on the object’s header and go to Properties.
A configuration window will open as shown below.
Let’s look at the properties on this window.
Parse Data Pattern – contains three patterns in which the dataset can be parsed:
- 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.
Click Next. This is the Layout Builder screen.
5. Here, write the names of the fields that you want to create.
Click OK. The Delimited Parser object now has new fields in the Output node.
To preview data, right-click on the object’s header and select Preview Output from the context menu.
A Data Preview window will open. Upon expanding the records, you can view the parsed output.
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 Centerprise.