I have a looping node NationalityDet which holds multiple current former nationality or citizenships (CurrentNatCit) I need to ensure that all the Country values for Current Nationality map go to the nationality node and Current citizenship are mapped to Citizenship node, all former Nationality/citizenship are mapped to the OtherNationality/OtherCitizenship (Citizenship is only allowed one record it is node). Any ideas?

Source sample

<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>

Destination sample

<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>

Currently have used the looping functoid u mentioned and a number of equals and &'s to allow for this mapping. I am stuck in regards to counting the nodes from two different parent nodes for TYPE=CITIZENSHIP and STATUS=FORMER for OtherCitizenship. any thoughts?

有帮助吗?

解决方案

It is rather unclear from your question and sample as to exactly what you want mapped where.

But the pattern you will probably need is as below. Add a looping functoid that goes to both the singleton and repeating node. Add an Iteration functoid that goes to an equals functoid and a greater than functoid both with a second fixed value of 1, and map respectively to the singleton and the repeating node. Map the source field to both fields.

enter image description here

Update after question changed.

So lets say you have the following 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.

Then your map will look like this

I will explain the highlighted shapes, the rest follow the same pattern. From top to bottom, left to right.

  1. An looping functoid linked to both NatCit and OtherNatCit and linked to Nationality.
  2. An equal functoid linked to NatCit\Type and value NATIONALITY
  3. An equal functoid linked to NatCit\Status and value CURRENT
  4. An equal functoid linked to OtherNatCit\Type and value NATIONALITY
  5. An equal functoid linked to OtherNatCit\Status and value CURRENT
  6. An AND functoid lined to the two equal functoids of NatCit
  7. An AND functoid lined to the two equal functoids of OtherNatCit
  8. A Value mapping functoid linked to the AND from NatCit and NatCit\Country going to Person1\Nationality.
  9. A Value mapping functoid linked to the AND from OtherNatCit and OtherNatCit\Country going to Person1\Citizenship.

I then copied the first group and changed the NATIONALITY to CITIZENSHIP and linked to the same input fields but putting the outputs of the value mapping to Citizenship.

I then copied the first group and changed the CURRENT to FORMER and linked to the same input fields but putting the outputs of the value mapping to OtherNationality\Nationality.

I then copied the second group (which has CITIZENSHIP ) and changed the CURRENT to FORMER and linked to the same input fields but putting the outputs of the value mapping to OtherCitenship.

Below is the output.

<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>
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top