BizTalk Gurus

Debatch flat file - multiline record into separate messages

rated by 0 users
Not Answered This post has 0 verified answers | 5 Replies | 2 Followers

posted on Sun, Jun 7 2009 10:47 AM

Hi,

I have a flat file records which I need to debatch into separate message. I can create schema for single record but cannot get mutipe messages by having mutipe records in the flat file. My records are as

ORDER100|2009-04-01
IT-1000Fuse Bulbs  5
IT-1000Fuse Bulbs  2
ORDER100|2009-04-01
IT-1000Fuse Bulbs  5
IT-1000Fuse Bulbs  2
Record Line One --> ORDER100|2009-04-01
Record Line Two --> IT-1000Fuse Bulbs  5
I can create schema for one record but how do debatch multiple records into mutiple messages.

Any hep would be deeply appreciated. Thanks in advance

All Replies

replied on Sun, Jun 7 2009 2:02 PM

I guess you need to debatch the message per ORDER. You can do that using flat file dissassembler component in pipeline.

Once you generate the schema using flat file wizard, change the "Max Occurs" property of ORDER node to 1.  Then use a receive pipeline component, drag a flat file dissassembler component and use the above schema in the "Document Schema" property. Then use the above receive pipeline to receive the flat file message.

Hope it helps...

SK 

Top 50 Contributor
32 Posts

Here is a detail tutorial to debatching a flat file : http://geekswithblogs.net/benny/archive/2006/02/05/68249.aspx

replied on Mon, Jun 8 2009 2:13 AM

Hi,

Thanks for the response. This is the main issue. I have gone through the post while looking for solution. Actually Order record is a multiline record. So, with Schema I have one record for Order and next for Item (repeating record). Now If i test with 1 message, pipeline creates single xml message. If I place a repeating record in flat file, pipeline still creates a single message as it takes next order record as an item record. I have placed ORDER as Tag for the order record. Assigning Maxoccur property to order ecord will do fine for order record but not for items.

So, If I have the above mentiones data in flat file I will get a message like

<Order>
</Order>
<Item>
</Item>
<Item>
</Item>
<Item>
</Item>
<Item>
</Item>

 

Top 10 Contributor
877 Posts

Try this schema:

<xs:schema xmlns:b="http://schemas.microsoft.com/BizTalk/2003" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:annotation>
    <xs:appinfo>
      <b:schemaInfo standard="Flat File" root_reference="Order" default_pad_char=" " pad_char_type="char" count_positions_by_byte="false" parser_optimization="speed" lookahead_depth="3" suppress_empty_nodes="false" generate_empty_nodes="true" allow_early_termination="false" early_terminate_optional_fields="false" allow_message_breakup_of_infix_root="false" compile_parse_tables="false" default_child_order="infix" child_delimiter_type="hex" default_child_delimiter="0x0D 0x0A" />
      <schemaEditorExtension:schemaInfo namespaceAlias="b" extensionClass="Microsoft.BizTalk.FlatFileExtension.FlatFileExtension" standardName="Flat File" xmlns:schemaEditorExtension="http://schemas.microsoft.com/BizTalk/2003/SchemaEditorExtensions" />
    </xs:appinfo>
  </xs:annotation>
  <xs:element name="Order">
    <xs:annotation>
      <xs:appinfo>
        <b:recordInfo structure="delimited" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" sequence_number="1" child_order="postfix" child_delimiter_type="default" />
      </xs:appinfo>
    </xs:annotation>
    <xs:complexType>
      <xs:sequence>
        <xs:annotation>
          <xs:appinfo>
            <b:groupInfo sequence_number="0" />
          </xs:appinfo>
        </xs:annotation>
        <xs:element name="Header">
          <xs:annotation>
            <xs:appinfo>
              <b:recordInfo sequence_number="1" structure="delimited" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" child_order="infix" child_delimiter_type="char" child_delimiter="|" tag_name="ORDER" />
            </xs:appinfo>
          </xs:annotation>
          <xs:complexType>
            <xs:sequence>
              <xs:annotation>
                <xs:appinfo>
                  <b:groupInfo sequence_number="0" />
                </xs:appinfo>
              </xs:annotation>
              <xs:element name="Field" type="xs:string">
                <xs:annotation>
                  <xs:appinfo>
                    <b:fieldInfo sequence_number="1" justification="left" />
                  </xs:appinfo>
                </xs:annotation>
              </xs:element>
              <xs:element name="Date" type="xs:date">
                <xs:annotation>
                  <xs:appinfo>
                    <b:fieldInfo sequence_number="2" justification="left" datetime_format="yyyy-MM-dd" />
                  </xs:appinfo>
                </xs:annotation>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
        <xs:element name="Items">
          <xs:annotation>
            <xs:appinfo>
              <b:recordInfo sequence_number="2" structure="delimited" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" child_order="infix" child_delimiter_type="default" />
            </xs:appinfo>
          </xs:annotation>
          <xs:complexType>
            <xs:sequence>
              <xs:annotation>
                <xs:appinfo>
                  <b:groupInfo sequence_number="0" />
                </xs:appinfo>
              </xs:annotation>
              <xs:element maxOccurs="unbounded" name="Item">
                <xs:annotation>
                  <xs:appinfo>
                    <b:recordInfo sequence_number="1" structure="positional" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" tag_name="IT" tag_offset="0" />
                  </xs:appinfo>
                </xs:annotation>
                <xs:complexType>
                  <xs:sequence>
                    <xs:annotation>
                      <xs:appinfo>
                        <b:groupInfo sequence_number="0" />
                      </xs:appinfo>
                    </xs:annotation>
                    <xs:element name="Code" type="xs:string">
                      <xs:annotation>
                        <xs:appinfo>
                          <b:fieldInfo sequence_number="1" justification="left" pos_length="5" pos_offset="2" />
                        </xs:appinfo>
                      </xs:annotation>
                    </xs:element>
                    <xs:element name="Description" type="xs:string">
                      <xs:annotation>
                        <xs:appinfo>
                          <b:fieldInfo sequence_number="2" justification="left" pos_length="12" />
                        </xs:appinfo>
                      </xs:annotation>
                    </xs:element>
                    <xs:element name="Quantity" type="xs:string">
                      <xs:annotation>
                        <xs:appinfo>
                          <b:fieldInfo sequence_number="3" justification="left" pos_length="1" />
                        </xs:appinfo>
                      </xs:annotation>
                    </xs:element>
                  </xs:sequence>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>

 

replied on Fri, Jun 26 2009 1:00 AM

did you manage to solve it? i have a similar problem

message looks like:

Header
Details
Trailer
Header
Details
Trailer

 

Page 1 of 1 (6 items) | RSS