Flat File Interchanges with Multiple Document Types
Flat file interchanges with BizTalk are really useful for handling large files that contain messages that need to be individually processed. However one of their limitation is that they only support one flat file schema as the interchange’s document schema:
In some instances, one might want to process interchanges that contain more than one type of message such as:
The flat file has a batch header, and a series of purchases and work orders that have different formats. In order to parse this, one needs to create a flat file schema with a choice group that will make the flat file disassembler parse either of the two formats. That choice schema can then be used as the document schema in the flat file disassembler (the min/max occurs properties of the PO and WO nodes need to be set to 0/1):
And the following represents the pipeline settings:
This results in messages of type BatchItemFF that either contain a PO or WO node to be created on the other side of the pipeline. Stripping the root node and injecting a namespace can either be done in an orchestration with conditional mapping logic or a custom pipeline component.
These are examples of the output messages:
Sample artifacts can be found here.