cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping Query

Former Member
0 Kudos

Hi,

I have asked a very similar question before and I thought it had been answered, but it turns out there is still an issue. What I have is a message structure like:

<reports>

   <report>

      <id>111</id>

      <evidence></evidence>

   </report>

   <report>

      <id>222</id>

      <evidence>

         <file>file1</file>

         <file>file2</file>

      </evidence>

   </report>

</reports>


Which I want to map to:


<reports>

   <report>

      <id>111</id>

      <evidence></evidence>

   </report>

   <report>

      <id>222</id>

      <evidence>

         <evidence_links>

            <link_url>file1</link_url>

         </evidence_links>

         <evidence_links>

            <link_url>file2</link_url>

         </evidence_links>

      </evidence>

   </report>

</reports>


I have tried using:



But this doesn't work and produces:


<reports>

   <report>

      <id>111</id>

      <evidence></evidence>

   </report>

   <report>

      <id>222</id>

      <evidence>

         <evidence_links></evidence_links>

         <evidence_links>

            <link_url>file1</link_url>

         </evidence_links>

      </evidence>

   </report>

</reports>

i.e. only one of the two links shows correctly in the second report node. For info if there was only one report node (the second one) then the mapping would work. The issue seems to be connected to having empty instances of the <evidence> node - they seem to impact following nodes.


Any help would be appreciated.


Cheers,


PaulC.

Accepted Solutions (1)

Accepted Solutions (1)

Harish
Active Contributor
0 Kudos

Hi Paul,

your mapping of evidence_links should be


file -->>remove context-->>evidence_links


regards,

Harish

Former Member
0 Kudos

Harish,

Thanks for your reply. As advised I now have:

with:

file -->>remove context-->>evidence_links

file -->>Split By Value (Each Value)-->>link_url


However, this is no better. When mapping:


<reports>

   <report>

      <id>111</id>

      <evidence></evidence>

   </report>

   <report>

      <id>222</id>

      <evidence>

         <file>file1</file>

         <file>file2</file>

      </evidence>

   </report>

</reports>


I now get:


<reports>

   <report>

      <id>111</id>

      <evidence>

         <evidence_links></evidence_links>

         <evidence_links>

            <link_url>file1</link_url>

         </evidence_links>

      </evidence>

   </report>

   <report>

      <id>222</id>

      <evidence></evidence>

   </report>

</reports>


i.e. same as before except the evidence is now against the wrong reports.


Any ideas?


Cheers,


PaulC.

Former Member
0 Kudos

Make sure that you don't change the context of file, so set the context to original if you chagned it before and then try...

file ---->>MapWithDefault ---->>evidence_links

If above doesn't work then try with this one as well...

file ---->>MapWithDefault ----->>SplitByValue(each value) ----->>evidence_links

azharshaikh
Active Contributor
0 Kudos

Hi Paul,

You can achieve it as follows:

Regards,

Azhar

Former Member
0 Kudos

Azhar,

Thanks for the reply.

Yes, I stumbled upon this earlier this morning. Previous posts had mentioned 'Remove Context' and 'SplitByValue' in separate solutions so I just decided to try and stick them together in the one mapping...and it worked. However, it's good to see that someone has come up with the same solution. Shows it must be indeed be the correct one.

Cheers,

PaulC.

Answers (0)