In this post i will describe you how to read/process multi schema delimited file using tFileInutMSDelimited component.
here is our sample input data which has header records then its trailer records.
Invoice Header record start with “H” alphabet and Invoice Detail/trailer record start with “T” Alphabet.
we will use tFileInutMSDelimited component to parse these records. so create a job and drag and drop tFileInutMSDelimited component and then double click on it, it will show you another screen for metadata creation.
select our source file, then select column separator & row separator, once that is done then flow the below steps.
- In preview window select first column which has “H” and “T” values.
- In Schema grid click on add button and provide following values.
- Schema=H
- Record=H
- Separator=;
- Click on “OK” you will one record created with provided values.
- Click on fetch Codes button, it fetch all the visible codes from mention file and creates schema based on column delimiter.
- Our configuration looks like below image.
- Now go to the component setting tab and click on first schema which may look like row_A_1 click on it.
- it will show you schema with default column names.
- modify column name as follows.
- We are done with Header schema now do the same thing with Trailer schema and modify column names.
- Add tLogRow and connect to the tFileInputMSDelimited component using “row_A_1” schema.
- Do the Same thing for “row_B_1” schema.
- Now Execute the job your output will be like this.
you can achieve same thing using other ways, but trust me this is the most simple way.
Hi Umesh,
I was wondering if we can have a default schema or something which does not belong to a Header / Trailer schema by using operators, regex etc?
Cheers
rather you can regex parser using Talend component
Thanks Umesh.