Talend Read Dynamic File Structure

The data coming in text files is unpredictable. One day, we might get ten columns, the next day 12 columns, the other day columns in a completely different order, etc. If our source file has a dynamic structure or Muti structure, we can use the Talend tFileInputMSDelimited component to read or handle the same.

To demonstrate the Talend tFileInputMSDelimited to read dynamic file structure, we use the below file.

Source Text

From the above image, you can see, that Canada has four columns, France has three columns, and the order of the columns of all the countries is different.

Talend read dynamic file structure Example

First, drag and drop the tFileInputMSDelimited to read the multi-structure or dynamic file structure.

Talend Read Dynamic File Structure 2

Click on the Multi Schema Editor button.

Click the Multi Schema Editor

It is the place where we have to fetch the structures based on the filed separator. Most of the components are the same as the tFileInputDelimited.

Please click on the Browse button and select or read the Dynamic Source text file from the file system. Next, change the Field Separator as per your need, and click the Preview button to see the data preview.

Talend Read Dynamic Multi File Structure 6

Please select or checkmark the Common column or say group by column to fetch the codes. By default, it will select the column; otherwise, you can select the required column. Next, click the Fetch Codes button.

Fetch Cods in Talend to Read Dynamic Multi File Structure

If there are multiple separators in the text file to separate the columns, then checkmark the Use multiple separators option and place them in the below text box.

Use Multi-Separator option in Talend to Read Dynamic Multi File Structure

Now you can see all the Connections under the Output columns.

Check the Output

Once you right-click on the Talend tFileInputMSDelimited and select the Rows option, you can see all the outputs. For the Talend Read Dynamic File Structure example, we assigned each output to tLogRow with a table preview.

Talend Read Dynamic Multi File Structure 10

Please run the Talend Read Multi Structure File to see the output. You can also change the column names based on the requirements.

Run the Talend Read Dynamic Multi File Structure Job