0

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?

Dijkgraaf
  • 11,049
  • 17
  • 42
  • 54
PuffTMD
  • 63
  • 9

1 Answers1

1

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>
Dijkgraaf
  • 11,049
  • 17
  • 42
  • 54
  • @Dijkgraff Thank you for your reply and apologies around clarity of the question. The problem I have is that the Source Type can be either Nationality or Citizenship so if the first entry is Citizenship (1) and the second (2) is Nationality this would break the map ? – PuffTMD Mar 17 '14 at 10:20
  • Thanks @Dijkgraff been some updates which had forced a change so now I'm back. UPdated the thread hoping to see if i can implement your solution (iteration) across different parent nodes. – PuffTMD May 21 '14 at 15:12
  • I've updated the answer to reflect your changed question. This one does not use iteration. – Dijkgraaf May 21 '14 at 22:35
  • @Dijkgraff That is exactly how mine looks although in 2006 you cant have the nice selection etc... lol and I have linked the repeating source nodes to the same looping functoid rather than repeating ones is there a difference? the outstanding problem i had was that the last node OtherCitizenship must only contain a single result which is what is proving difficult as the looping functoid seems to be causing a problem with this as well as implementing a count and limit for just the Type CITIZENSHIP – PuffTMD May 22 '14 at 06:48
  • Yes there will be a difference if you link to the same looping functoid. That basically says that it is going to iterate through them in a single loop and all logical conditions must be met before it maps the values. As you have different criteria for the different target fields, you need one looping functoid for each target field. Your input data structure doesn't enforce that the OtherCitizenship is only single occurrence, so trying to get the map to enforce that will be impossible. – Dijkgraaf May 25 '14 at 22:55