i have a flat file with header and trailers with Tag Identifiers as APTHDR and APTDTL respectively.
The current file has me miffed however, as it has a repeating record issue. File Structure:
20data for the summary information
HE Header of record
DE Detail of record
HE Header of record
DE Detail of record
DE Detail of record
20 trailler data
record 20 = one instance for summary, one instance for trailler record.
record HE: one HE have multiple DE. one file have multiple HE.
this is the data example:
20201117125512HH 001APPOINTMENT DATA 85372
HE0350100000001 1 2CROS04202020-11-25012020-11-25 15:30:00.000000 PIC077120 128027 2020-11-17 12:50:52.000265 N N 0000004390000000000186000000 00000 PIC077120 023095412
DE035010000000C116780360635000000439PIC077120 023095412
HE0350100000001 1 2CACG05002020-11-25012020-11-25 14:00:00.000000 3501382191/, 183699 2020-11-17 12:51:02.000864 N Y NS0000013210083300043754000000 00000 3501382191/, 1621476023035082
DE035010000000C3100203821910000010013501382191/, 1621476023035082
DE035010000000C3100202566840000001003501382191/, 1621476023035082
DE035010000000C3100203826550000001073501382191/, 1621476023035082
DE035010000000C3100203852630000000203501382191/, 1621476023035082
DE035010000000C3100203746790000000183501382191/, 1621476023035082
DE035010000000C3100202903510000000753501382191/, 1621476023035082
20201117125512TT 001000000000000000000110000000000
I get the results in the correct placement if I use a single set, but once I try to create a multiple record file it get hosed. I just have no idea how to fix it.
Thanks!
First of all you need to create 3 schemas, a Header, a Body and a Trailer. Split the file you have into those components so you can test each schema against that part, for the body just have the one HE and multiple DE.
Then you need to create a pipeline with a flat file disassemble component and set all three schema in the properties.
Deploy these, create a receive port and location that uses the pipeline, and have something subscribing to the messages.
Example schemas
Header schema
<?xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns="http://Scratch.SO68310662" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" targetNamespace="http://Scratch.SO68310662" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:annotation>
<xs:appinfo>
<b:schemaInfo standard="Flat File" root_reference="Header" 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" />
<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="Header">
<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="hex" child_delimiter="0x0D 0x0A" />
</xs:appinfo>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:annotation>
<xs:appinfo>
<b:groupInfo sequence_number="0" />
</xs:appinfo>
</xs:annotation>
<xs:element name="HeaderRecord">
<xs:annotation>
<xs:appinfo>
<b:recordInfo sequence_number="1" structure="positional" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" />
</xs:appinfo>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:annotation>
<xs:appinfo>
<b:groupInfo sequence_number="0" />
</xs:appinfo>
</xs:annotation>
<xs:element name="DateTime">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" pos_length="14" sequence_number="1" />
</xs:appinfo>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string" />
</xs:simpleType>
</xs:element>
<xs:element name="Field" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" pos_length="64" sequence_number="2" />
</xs:appinfo>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Body Schema
<?xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns="http://Scratch.SO68310662" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" targetNamespace="http://Scratch.SO68310662" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:annotation>
<xs:appinfo>
<b:schemaInfo standard="Flat File" root_reference="Body" 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" />
<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="Body">
<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="hex" child_delimiter="0x0D 0x0A" />
</xs:appinfo>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:annotation>
<xs:appinfo>
<b:groupInfo sequence_number="0" />
</xs:appinfo>
</xs:annotation>
<xs:element name="HeaderRecord">
<xs:annotation>
<xs:appinfo>
<b:recordInfo sequence_number="1" structure="positional" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" tag_name=" HE" />
</xs:appinfo>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:annotation>
<xs:appinfo>
<b:groupInfo sequence_number="0" />
</xs:appinfo>
</xs:annotation>
<xs:element name="Field1" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" pos_length="263" sequence_number="1" pos_offset="3" />
</xs:appinfo>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element maxOccurs="unbounded" name="DetailRecord">
<xs:annotation>
<xs:appinfo>
<b:recordInfo sequence_number="2" structure="positional" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" tag_name=" DE" />
</xs:appinfo>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:annotation>
<xs:appinfo>
<b:groupInfo sequence_number="0" />
</xs:appinfo>
</xs:annotation>
<xs:element name="Field1" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" sequence_number="1" pos_length="63" pos_offset="3" />
</xs:appinfo>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Trailer schema
<?xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns="http://Scratch.SO68310662" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" targetNamespace="http://Scratch.SO68310662" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:annotation>
<xs:appinfo>
<b:schemaInfo standard="Flat File" root_reference="Header" 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" />
<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="Header">
<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="hex" child_delimiter="0x0D 0x0A" />
</xs:appinfo>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:annotation>
<xs:appinfo>
<b:groupInfo sequence_number="0" />
</xs:appinfo>
</xs:annotation>
<xs:element name="TrailerRecord">
<xs:annotation>
<xs:appinfo>
<b:recordInfo sequence_number="1" structure="positional" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" />
</xs:appinfo>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:annotation>
<xs:appinfo>
<b:groupInfo sequence_number="0" />
</xs:appinfo>
</xs:annotation>
<xs:element name="DateTime">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" pos_length="14" sequence_number="1" pos_offset="1" />
</xs:appinfo>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string" />
</xs:simpleType>
</xs:element>
<xs:element name="Field" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" pos_length="37" sequence_number="2" />
</xs:appinfo>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Output message 1
<Body xmlns="http://Scratch.SO68310662">
<HeaderRecord xmlns="">
<Field1>0350100000001 1 2CACG05002020-11-25012020-11-25 14:00:00.000000 3501382191/, 183699 2020-11-17 12:51:02.000864 N Y NS0000013210083300043754000000 00000 3501382191/, 1621476023035082</Field1>
</HeaderRecord>
<DetailRecord xmlns="">
<Field1>035010000000C3100203821910000010013501382191/, 1621476023035082</Field1>
</DetailRecord>
<DetailRecord xmlns="">
<Field1>035010000000C3100202566840000001003501382191/, 1621476023035082</Field1>
</DetailRecord>
<DetailRecord xmlns="">
<Field1>035010000000C3100203826550000001073501382191/, 1621476023035082</Field1>
</DetailRecord>
<DetailRecord xmlns="">
<Field1>035010000000C3100203852630000000203501382191/, 1621476023035082</Field1>
</DetailRecord>
<DetailRecord xmlns="">
<Field1>035010000000C3100203746790000000183501382191/, 1621476023035082</Field1>
</DetailRecord>
<DetailRecord xmlns="">
<Field1>035010000000C3100202903510000000753501382191/, 1621476023035082</Field1>
</DetailRecord>
</Body>
Output message 2
<Body xmlns="http://Scratch.SO68310662">
<HeaderRecord xmlns="">
<Field1>0350100000001 1 2CROS04202020-11-25012020-11-25 15:30:00.000000 PIC077120 128027 2020-11-17 12:50:52.000265 N N 0000004390000000000186000000 00000 PIC077120 023095412</Field1>
</HeaderRecord>
<DetailRecord xmlns="">
<Field1>035010000000C116780360635000000439PIC077120 023095412</Field1>
</DetailRecord>
</Body>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.