如何使用BizTalk从查询中创建包含标题和行的平面文件?

如何使用BizTalk从查询中创建包含标题和行的平面文件?,biztalk,biztalk-2010,Biztalk,Biztalk 2010,我是BizTalk新手,正在设法创建从Oracle到平面文件的普通接口 但是我们的大多数接口都是一个标题和不同长度的行的组合 例如,查询将是 select oh.id, oh.name, ol.lineNo, ol.qty_ordered, ol.qty_shipped, ol.price from header oh, line ol 这将导致类似于此的平面文件 oh.id | oh.name ol.lineNo | ol.qty_ordered | ol.qty_

我是BizTalk新手,正在设法创建从Oracle到平面文件的普通接口

但是我们的大多数接口都是一个标题和不同长度的行的组合

例如,查询将是

select oh.id, oh.name, ol.lineNo, ol.qty_ordered, ol.qty_shipped, ol.price 
from header oh, line ol
这将导致类似于此的平面文件

oh.id       |  oh.name
ol.lineNo   |  ol.qty_ordered  |  ol.qty_shipped  |  ol.price
ol.lineNo   |  ol.qty_ordered  |  ol.qty_shipped  |  ol.price
ol.lineNo   |  ol.qty_ordered  |  ol.qty_shipped  |  ol.price
oh.id       |  oh.name
ol.lineNo   |  ol.qty_ordered  |  ol.qty_shipped  |  ol.price
ol.lineNo   |  ol.qty_ordered  |  ol.qty_shipped  |  ol.price

我确信BizTalk的设置并不奇怪,但我不知道如何调用它,所以我无法用谷歌搜索它。到目前为止,我似乎在创建一个模式和映射时遇到了一个问题,该模式和映射将允许行如此不同

我建议使用BizTalk模式向导


注意:我只对
BizTalk
和平面文件做了一点工作,但我发现这篇文章作为初学者非常有用

如果我理解正确(我假设您需要一个用于映射器的模式),那么您需要一个类似

     <?xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns="http://BizTalk_Server_Project1.FlatFileSchema1" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" targetNamespace="http://BizTalk_Server_Project1.FlatFileSchema1" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:annotation>
    <xs:appinfo>
      <schemaEditorExtension:schemaInfo namespaceAlias="b" extensionClass="Microsoft.BizTalk.FlatFileExtension.FlatFileExtension" standardName="Flat File" xmlns:schemaEditorExtension="http://schemas.microsoft.com/BizTalk/2003/SchemaEditorExtensions" />
      <b:schemaInfo standard="Flat File" codepage="65001" 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" root_reference="Sales" wrap_char_type="char" default_wrap_char="&quot;" />
    </xs:appinfo>
  </xs:annotation>
<xs:element name="orders">
        <xs:complexType>
        <xs:sequence>
        <xs:element maxOccurs="unbounded" name="order">
        <xs:complexType>
        <xs:sequence>
        <xs:element maxOccurs="1" minOccurs="1" name="orderheader">
        <xs:complexType>
        <xs:sequence>
        <xs:element maxOccurs="1" minOccurs="1" name="ohID"/>
        <xs:element maxOccurs="1" minOccurs="1" name="ohName"/>
        </xs:sequence>
        </xs:complexType>
    </xs:element>
        <xs:element maxOccurs="1" minOccurs="1" name="orders">
        <xs:complexType>
        <xs:sequence>
        <xs:element maxOccurs="1" minOccurs="1" name="ohLineNo"/>
        <xs:element maxOccurs="1" minOccurs="1" name="ohQuantityOrdered"/>
        <xs:element maxOccurs="1" minOccurs="1" name="ohQuantityShipped"/>
        <xs:element maxOccurs="1" minOccurs="1" name="ohPrice"/>
        </xs:sequence>
        </xs:complexType>
    </xs:element>
        </xs:sequence>
        </xs:complexType>
        </xs:element>
        </xs:sequence>
        </xs:complexType>
        </xs:element></xs:schema>


您的模式很好,我使用的映射用于订单,然后使用for循环来循环行并添加它们。由于大多数映射对我来说是非常独特的,我不确定是应该回答我自己的问题还是接受你的答案。