是否可以在 Biztalk 中设置平面文件源组件以读取 "Ragged Right" 个文件?

Is it possible to set the Flat File Source Component in Biztalk to read "Ragged Right" Files?

需要将带有 Biztalk 的 "Ragged Right" 平面文件导入某些目标位置,如 SQL 数据库和 CRM Web 服务。

文件格式如下

Column1(10characters)Column2(13characters)Column3(17Chars.)Column4(till Row deliminator CRLF)

平面文件架构向导的Biztalk哪里可以设置最后一列没有固定宽度?

我知道它可以在 SSIS 中使用,但这是不可能的。我们现在需要用 Biztalk2010

来做到这一点

一种解决方法。

给定一个样例文件

Column1   Column2      Column3          Column4             {CR}{LF}
123456789012345678901231234567890123456712345678901234567890{CR}{LF}
Test1A    Test1B       Test1C           Test1D{CR}{LF}
Test2A    Test2B       Test2C           Testing2D{CR}{LF}

之后通过编辑架构将最后一列的位置长度设置为 1,并将最大出现次数设置为无界。

您的 XML 输出将如下所示。然后,您可以使用 Cumulative Functiod 将 scope 参数设置为 1,重新 assemble 带有地图的最后一列。 注意:但是它不保留白色space,这可能是一个需要解决的问题。

XML输出

<Ragged xmlns="http://Scratch.Ragged">
    <Ragged_Child1 xmlns="">
        <Column1>Column1</Column1>
        <Column2>Column2</Column2>
        <Column3>Column3</Column3>
        <Column4>C</Column4>
        <Column4>o</Column4>
        <Column4>l</Column4>
        <Column4>u</Column4>
        <Column4>m</Column4>
        <Column4>n</Column4>
        <Column4>4</Column4>
        <Column4/>
        <Column4/>
        <Column4/>
        <Column4/>
        <Column4/>
        <Column4/>
        <Column4/>
        <Column4/>
        <Column4/>
        <Column4/>
        <Column4/>
        <Column4/>
        <Column4/>
    </Ragged_Child1>
    <Ragged_Child1 xmlns="">
        <Column1>1234567890</Column1>
        <Column2>1234567890123</Column2>
        <Column3>12345678901234567</Column3>
        <Column4>1</Column4>
        <Column4>2</Column4>
        <Column4>3</Column4>
        <Column4>4</Column4>
        <Column4>5</Column4>
        <Column4>6</Column4>
        <Column4>7</Column4>
        <Column4>8</Column4>
        <Column4>9</Column4>
        <Column4>0</Column4>
        <Column4>1</Column4>
        <Column4>2</Column4>
        <Column4>3</Column4>
        <Column4>4</Column4>
        <Column4>5</Column4>
        <Column4>6</Column4>
        <Column4>7</Column4>
        <Column4>8</Column4>
        <Column4>9</Column4>
        <Column4>0</Column4>
    </Ragged_Child1>
    <Ragged_Child1 xmlns="">
        <Column1>Test1A</Column1>
        <Column2>Test1B</Column2>
        <Column3>Test1C</Column3>
        <Column4>T</Column4>
        <Column4>e</Column4>
        <Column4>s</Column4>
        <Column4>t</Column4>
        <Column4>1</Column4>
        <Column4>D</Column4>
    </Ragged_Child1>
    <Ragged_Child1 xmlns="">
        <Column1>Test2A</Column1>
        <Column2>Test2B</Column2>
        <Column3>Test2C</Column3>
        <Column4>T</Column4>
        <Column4>e</Column4>
        <Column4>s</Column4>
        <Column4>t</Column4>
        <Column4>i</Column4>
        <Column4>n</Column4>
        <Column4>g</Column4>
        <Column4>2</Column4>
        <Column4>D</Column4>
    </Ragged_Child1>
</Ragged>

地图

地图输出

<ns0:Ragged xmlns:ns0="http://Scratch.Ragged">
    <Ragged_Child1>
        <Column1>Column1</Column1>
        <Column2>Column2</Column2>
        <Column3>Column3</Column3>
        <Column4>Column4</Column4>
    </Ragged_Child1>
    <Ragged_Child1>
        <Column1>1234567890</Column1>
        <Column2>1234567890123</Column2>
        <Column3>12345678901234567</Column3>
        <Column4>12345678901234567890</Column4>
    </Ragged_Child1>
    <Ragged_Child1>
        <Column1>Test1A</Column1>
        <Column2>Test1B</Column2>
        <Column3>Test1C</Column3>
        <Column4>Test1D</Column4>
    </Ragged_Child1>
    <Ragged_Child1>
        <Column1>Test2A</Column1>
        <Column2>Test2B</Column2>
        <Column3>Test2C</Column3>
        <Column4>Testing2D</Column4>
    </Ragged_Child1>
</ns0:Ragged>

这是一个更好的答案

来自博客Early Termination with Position Flat Files

To make BizTalk recognize an early terminator you need to open your schema in a text editor and add allow_early_termination = “true” to the xs:annotation node. This property is not exposed in the BizTalk XSD editor.

这篇文章可能是关于 BizTalk 2004 的,但它仍然适用于 BizTalk 2013 R2。因此,只需右键单击您的架构,select 打开方式和 select XML(文本)编辑器并进行上述更改。

更新: 刚刚签入 Visual Studio 2013,这些属性现在可以在架构属性中使用