[英]Biztalk Debatch flat file with header, 2 repeating records and trailer with tag identifiers
i have a flat file with header and trailers with Tag Identifiers as APTHDR and APTDTL respectively.我有一个带有标头和标头的平面文件,标签标识符分别为 APTHDR 和 APTDTL。
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.记录 20 = 一个用于摘要的实例,一个用于拖车记录的实例。
record HE: one HE have multiple DE.记录HE:一个HE有多个DE。 one file have multiple HE.
一个文件有多个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.首先,您需要创建 3 个模式,一个 Header、一个 Body 和一个 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.
将您拥有的文件拆分为这些组件,以便您可以针对该部分测试每个模式,因为主体只有一个 HE 和多个 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输出消息 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输出消息 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>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.