Wednesday 13 March 2013

Flat File Schema in Biztalk



Flat File Schema:  A flat file schema defines the structure of a class of instance messages that use a flat file format, either delimited or positional or some combination thereof.

Several Legacy system are based on flat files .So conversion of flat files to xml is required in integration projects.

A Flat Files is of several Types:
  • ·         Delimiter,
  • ·         Positional and
  • ·         Combination of both.

Biztalk provides Flat File Schema Wizard for creating flat files Schemas.

In this article we will develop flat file schema for complex file using flat file schema wizard

Example:
INVOICE12345
DestinationPartnerURI:http://www.contoso.com?ID=1E1B9646-48CF-41dd-A0C0-1014B1CE5064
BILLTO,US,John Connor,123 Cedar Street,Mill Valley,CA,90952
101-TT         Plastic flowers   10   4.99      Fragile handle with care
202-RR         Fertilizer        1    10.99     Lawn fertilizer        
453-XS         Weed killer       1    5.99      Lawn weed killer       

In this flatfile there are 4 Type of record

Step 1: Create New Biztalk Project
Step 2: Add New Item, Select Flat File Schema Wizard



















Step 3: Select Instance File.



















Step 4 : Every line in the flat file is delimited by CRLF , hence  Select option  By Delimiter Symbol.


















Step 5: Select Child delimiter as {cr}{lf}.

Step 6: Define Child elements .

·         The Elements type in case of Destination partner and bill to is record because it has more delimiter based fields.
·         The Elements type in case of Item is repeating record because it is repeating several times.
















Step 7: define field properties for each type of record.

Step 8: Destination partner have field with Delimiter (: ) , so select delimiter.















Step 9: BillTo record is based on delimiter (,) , hence select by Delimiter symbol option.














Step 10: now record item is position based, so define the position of each element.











After generating the Schema, right click on schema and validate the instance


No comments:

Post a Comment