简体   繁体   English

Biztalk将XML循环到平面文件

[英]Biztalk looping XML to flat file

I have an input record that looks like this: 我有一个看起来像这样的输入记录:

<employee>
    <empid>1234</empid>
    <name>John Smith</name>
    ...
    <benefit>
         <plan_name>HSA</plan_name>
         <effective_date>01-01-2015</effective_date>
    </benefit>
</employee>

I need to take this to a csv file. 我需要将此保存到一个csv文件中。 So far so good. 到现在为止还挺好。 Now there is a problem in that some of the employees have multiple benefits. 现在存在一个问题,其中一些员工有多重利益。

<employee>
    <empid>1234</empid>
    <name>John Smith</name>
    ...
    <benefit>
         <plan_name>HSA</plan_name>
         <effective_date>01-01-2015</effective_date>
    </benefit>
    <benefit>
         <plan_name>Limited FSA</plan_name>
         <effective_date>01-01-2015</effective_date>
    </benefit>
</employee>

In this situation, the resulting CSV file needs to have a new line for the second benefit. 在这种情况下,第二个好处是生成的CSV文件需要换行。 All the fields that are not benefits will be repeated on this line. 在该行中将重复所有非受益字段。 I tried a looping functoid going from the the benefit node in the source to the entire record of the destination (as a guy at work who does most of our BizTalk suggested), but it isn't repeating the line for those in the test file that have multiple benefits. 我尝试了一个从源中的Benefit节点到目标的整个记录​​的循环functoid(作为工作人员,他做了我们大多数的BizTalk的建议),但是它没有在测试文件中重复这些行有很多好处。 I just get one line for each employee. 我只给每位员工一行。

What I need: 我需要的:

1234,John Smith,...HSA,01-01-2015
1234,John Smith,...Limited FSA,01-01-2015

What I get: 我得到的是:

1234,John Smith,...HSA,01-01-2015

This should be pretty easy, I've done it a number of times. 这应该很容易,我已经做了很多次。

Start by linking <benefit> to <theCSVRowWlement> with a Looping Functoid. 首先使用循环功能将<benefit>链接到<theCSVRowWlement>

That will cause the Mapper to generate a for-each around <benefit> containing the entire CSV record. 这将导致Mapper在<benefit>周围生成包含每个CSV记录的for-each。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM