Blog Archives

Read Multi Schema Positional File

To read a Multi schema Positional file we will use tFileInutMSPositional component, 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

 

Advertisements

Read Multi Schema Delimited File

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.

Sample header-trailer records

Sample header-trailer records

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.
tFileInputMSDelimited configuration

tFileInputMSDelimited configuration

  • 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.
Header Schema details

Header Schema details

  • We are done with Header schema now do the same thing with Trailer schema and modify column names.
Trailer Schema details

Trailer Schema details

  • 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.
Header-Trailer Output

Header-Trailer Output

you can achieve same thing using other ways, but trust me this is the most simple way.