Monday 4 May 2015

Remove Header from CSV File in Biztalk

Hello Friends,

Please see below sample data which you receive in a flat file.

FName,MName,LName
John,K,Cena
Rambo,D,Parera

As you can see that first row is heading Like Fname,MName and LName. so when you do mapping then heading will be also mapped as data in target schema.

What my requirement is that I dont want to Include Heading in my output. I want only the exact data from the CSV file which I am receiving. for example only 2nd and third row.

I want Output as Below:




To achieve this target I have created one flat file schema and one target schema and mapped it. The step by step details I am attaching below:

Step 1: Add New Item and select Flat File Schema Wizard, give any name.



Step 2: In Flat File Schema Information Window Change the record Name and select the input Instance.
Step 3: In Select Doccument Data window Select the heading and and and first row after heading.


Step 4: Select Record Format By Delimiter Symbol.

Step 5: In Delimiter Record Select child Delimiter as CR LF.
Step 6: In Child Elements Window change the name as "Header" and the element Type of Header to "Record" and change the element type of exact date to "Repeating Record".

Step 7: In Schema View Select the Header and Click Next.

Step 8: In Select Document Data Window select the Header and click next.

Step 9:In Delimited Record select Child Delimiter as comma(,)
Step 10:In child Elements Window leave as it is or you can change the name and click next.

Step 11: Now select the Emp Node and click Next.
Step 12: In select doccument data window select the second row and click next.
Step 13: select , in Child Delimiter.
Step 14: In child Element window you can change the element name as required.
Click Finish to complete the wizard.

The source schema will look like as below:

Now Create a Target Schema same as below:
Now we will add a map to our project and will choose the source schema and target schema.

The mapping will be like below:

As you can see in above map we are not mapping the Header to Target schema so the heading will not come in target output.

we will get our required output without first row i.e Heading.

Our Output Will be Like below:



I hope I am clear in this demo. This is Sample one you can take it as a reference and complete your requirement.


1 comment:

  1. Thanks for posting This was very helpful and clear

    ReplyDelete