BizTalk file/ message splitting

464 Views Asked by At

I have a requirement in which I have to split the file contents based on value of the first column of the comma separated values in the source file.
Number of files to be generated in output depends on the number of unique values in the first column.

Eg:

FileName.txt
Code001,value11,value12,value13,value14
Code002,value21,value22,value23,value24
Code003,value31,value32,value33,value34
Code001,value15,value16,value17,value14
Code003,value37,value38,value39,value31

Output has to be number of files as the unique values in first column of the file content.

Ex Output: It should be 3 separate files with name and contents as below

Code001.txt
Code001,value11,value12,value13,value14
Code001,value15,value16,value17,value14

Code002.txt
Code002,value21,value22,value23,value24

Code003.txt
Code003,value31,value32,value33,value34
Code003,value37,value38,value39,value31

1

There are 1 best solutions below

0
On

This can actually be achieved in several ways, but one thing I'm thinking about is the following:

  1. Using a FF disassembler, just disassemble your FF schema to XML (as you would always have to do.
  2. Create an envelope and a document schema, which would fit your output schema. Your document schema would be similar to the output file you want in the end. You would want to work towards a document schema which matches the collection of your unique codes (Code001, Code002 and Code003).
  3. The idea would be to create an orchestration that will map your disassembled FF schema to the envelope schema. This cannot be done using a mapping in a receive/send port.
  4. In the orchestration, execute a receive pipeline, with an XML disassembler configured with your envelope and document schema. This will split your message into several messages.
  5. Bind your orchestration to a send port, which would map the instance to your output schema and send it through a FF assembler.