Read Multi Schema Positional File using tFileInutMSPositional

Read Multi Schema Positional File using tFileInutMSPositional
5 (100%) 1 vote

tFileInutMSPositional

component is use to read Multi schema Positional file, this component gives ability to read multiple schema based on certain columns value.

We are using Invoice file which has Invoice Header & invoice Details records in single file.

Sample file.

Header-Details Multi Schema Sample File
Header-Details Multi Schema Sample File

Invoice Header records start with “H” alphabet.

Invoice Details records start with “T’ alphabet.

follow the steps to read these multi schema records.

  • Create a job and add tFileinputMSPositional component.
  • Configure tFileinputMSPositional component with.
    • provide file Name.
    • row separator as per your file defaulted to “\n”
    • “Header Filed Position” this is the most important filed by which component will distinguish records whether it is header or detail. in our case first letter of row which is “H” for header and “T” for detail. so we will add value as “0-1″ that means start of record to 1 character long.
    • In “Records” section add two rows name it as “header” for Header records and “details”  for Details record.
    • once you add row it will ask you for schema add Header schema like below.
    • Header Schema
      Header Schema
    • Create details schema as follows.
    • Details Schema
      Details Schema
    •  Now add pattern for “header” as “1,8,6,8,3”.
    • Add pattern for details as “1,8,1,6,1,1,*”.
  • now our configuration completed.
  • Add two tLogRow component and from settings tab select “mode>Table”
  • Connect first tLogRow to the tFileInputMSPositional using “Header” link.
  • Connect Second tLogRow to the tFileInputMSPositional using “Detail” link.
  • Synch tLogRow columns.

Execute the job.  It will show you below output.

Header-Detail Output
Header-Detail Output

 

About Umesh

I am Software consultant with approx 7 years of experience mainly in Business Intelligence and data warehousing assignments using Talend. Writing is not my passion but i am doing it to help others. if you have any special case where you want me to demonstrate then please post me.

One thought on “Read Multi Schema Positional File using tFileInutMSPositional

  1. Hi,
    I’m very new to talend. I have a multi schema input file:
    000001-000010 Saunders, Fred status:A from: 08/01/2016 to: 09/01/2016
    Amt 40.76 16.25
    Usg 11600.00
    001014-000200 blythe, jeremy status:B from: 08/01/2016 to: 09/01/2016
    Amt 30.55 16.25 75.50
    Usg 2100.00
    ….
    I need to parse it into
    000010|Saunders|Fred|A|08/01/2016|09/01/2016|40.76|16.25||11600
    000200|blythe|jeremy|B|09/01/2016|09/01/2016|30.55|16.25|75.50|2100.00
    The 000xxx- Is ignored. I have tried tFileInputMSDelimited and tFileInputMSPositional. The problem is to separate the HeaderValues for 000xxx, Amt, Usg I need to use wildcards in the HeaderValue field to do something like “00/d/d/d/d-” for the 001014 type entries, where /d is any number. Is there some way to do this?

Leave a Reply

Your email address will not be published. Required fields are marked *