Biztalk Mapper表循环逻辑映射

时间:2014-03-14 09:33:50

标签: biztalk biztalk2006r2 biztalk-mapper

我有一个循环节点EthnicDet,它拥有多个现有的前国籍或公民身份(CurrentNatCit)我需要确保当前国籍地图的所有国家值都转到国籍节点,当前公民身份映射到公民身份节点,所有前国籍/公民身份映射到OtherNationality / OtherCitizenship(公民身份只允许一个记录,它是节点)。有什么想法吗?

源样本

<NationalityDet>
   <NatCit>
      <Type>NATIONALITY/CITIZENSHIP</Type>
      <Status>CURRENT/FORMER</Status>
      <Country>UK</Country>
   </NatCit>
   <OtherNatCit>
      <Type>NATIONALITY/CITIZENSHIP</Type>
      <Status>CURRENT/FORMER</Status>
      <Country>UK</Country>
   </OtherNatCit>
</NationalityDet>

目的地样本

<Person>
   <Person1>
      <Nationality>NATIONALITY/CURRENT</Nationality>
      <Nationality>NATIONALITY/CURRENT</Nationality>
      <Nationality>NATIONALITY/CURRENT</Nationality>
      <Citizenship>CITIZENSHIP/CURRENT</Citizenship>
      <Citizenship>CITIZENSHIP/CURRENT</Citizenship>
      <Citizenship>CITIZENSHIP/CURRENT</Citizenship>
      <OtherNationality>
         <Nationality>NATIONALITY/FORMER</Nationality>
         <Nationality>NATIONALITY/FORMER</Nationality>
         <Nationality>NATIONALITY/FORMER</Nationality>
      </OtherNationality>
      <OtherCitizenship>CITIZENSHIP/FORMER</OtherCitizenship>
   </Person1>
</Person>

目前已经使用了你提到的循环functoid和许多等号和&amp; s来允许这种映射。关于为两个不同的父节点计数TYPE = CITIZENSHIP和STATUS = FORMER for OtherCitizenship的节点,我陷入困境。有什么想法吗?

1 个答案:

答案 0 :(得分:1)

从你的问题和样本中可以确切地知道你想要映射到哪里。

但您可能需要的模式如下。添加一个循环functoid,它同时包含单例和重复节点。添加一个迭代functoid,它等于functoid,大于functoid,第二个固定值为1,并分别映射到singleton和repeat节点。将源字段映射到两个字段。

enter image description here

问题更改后更新。

因此,假设您有以下XML

<NationalityDet>
    <NatCit>
        <Type>NATIONALITY</Type>
        <Status>CURRENT</Status>
        <Country>UK</Country>
    </NatCit>
    <NatCit>
        <Type>CITIZENSHIP</Type>
        <Status>CURRENT</Status>
        <Country>Netherlands</Country>
    </NatCit>
    <NatCit>
        <Type>NATIONALITY</Type>
        <Status>FORMER</Status>
        <Country>Brazil</Country>
    </NatCit>   
    <NatCit>
        <Type>CITIZENSHIP</Type>
        <Status>FORMER</Status>
        <Country>USA</Country>
    </NatCit>      
    <OtherNatCit>
        <Type>NATIONALITY</Type>
        <Status>CURRENT</Status>
        <Country>Australia</Country>
    </OtherNatCit>
    <OtherNatCit>
        <Type>CITIZENSHIP</Type>
        <Status>CURRENT</Status>
        <Country>New Zealand</Country>
    </OtherNatCit>
    <OtherNatCit>
        <Type>NATIONALITY</Type>
        <Status>FORMER</Status>
        <Country>Argentina</Country>
    </OtherNatCit>
    <OtherNatCit>
        <Type>CITIZENSHIP</Type>
        <Status>FORMER</Status>
        <Country>Germany</Country>
    </OtherNatCit>
</NationalityDet>

然后你的地图会是这样的。

Then your map will look like this

我将解释突出显示的形状,其余的遵循相同的模式。从上到下,从左到右。

  1. 与NatCit和OtherNatCit相关联并与国籍相关联的循环functoid。
  2. 与NatCit \ Type和value NATIONALITY
  3. 相关联的平等功能
  4. 与NatCit \ Status和值CURRENT
  5. 相关联的同等functoid
  6. 与OtherNatCit \ Type和值NATIONALITY
  7. 相关联的同等functoid
  8. 与OtherNatCit \ Status和值CURRENT
  9. 关联的同等functoid
  10. 一个AND functoid排列在NatCit的两个相同的functoid
  11. AND functoid排列在OtherNatCit的两个相同的functoid
  12. 从NatCit和NatCit \ Country链接到AND的值映射functoid到Person1 \ Ethnic。
  13. 从OtherNatCit和OtherNatCit \ Country链接到AND的值映射functoid转到Person1 \ Citizenship。
  14. 然后我复制了第一组并将NATIONALITY更改为CITIZENSHIP并链接到相同的输入字段,但将值映射的输出放到Citizenship。

    然后我复制了第一个组并将CURRENT更改为FORMER并链接到相同的输入字段,但将值映射的输出放到OtherNationality \ Ethnic。

    然后我复制了第二组(具有CITIZENSHIP)并将CURRENT更改为FORMER并链接到相同的输入字段,但将值映射的输出放到OtherCitenship。

    以下是输出。

    <Person>
        <Person1>
            <Nationality>UK</Nationality>
            <Nationality>Australia</Nationality>
            <Citizenship>Netherlands</Citizenship>
            <Citizenship>New Zealand</Citizenship>
            <OtherNationality>
                <Nationality>Brazil</Nationality>
                <Nationality>Argentina</Nationality>
            </OtherNationality>
            <OtherCitizenship>USA</OtherCitizenship>
            <OtherCitizenship>Germany</OtherCitizenship>
        </Person1>
    </Person>