AnsweredAssumed Answered

Custom Script in Map shape

Question asked by phani.kumar@enjoy.com on Sep 18, 2017
Latest reply on Sep 19, 2017 by phani.kumar@enjoy.com

Experts,

 

How to loop a custom groovy script in Map shape for all the elements ?

Use case:

=======

1) My  Input profile:

<customers>

  <customer>

      <city>New York</city>

  </customer>

  <customer>

      <city>Chicago</city>

  </customer>

</customers>

 

2) Groovy Script I used in Map shape

=============================

If <city> == "New York"  then

 <city> should be "NY"

else

  <city> is "Others"

 

3)- Expected output:

===============

<customers>

  <customer>

      <city>NY</city>

  </customer>

  <customer>

      <city>Others</city>

  </customer>

</customers>

 

But, Actual Output :

==============

<customers>

  <customer>

      <city>NY</city>

  </customer>

 

</customers>

 

Approach I have followed.

=======================

Defined below map:

 

Script is :

 

Output I got :

 

AM I DOING ANY THING WRONG ??  Please comment.

 

My expected output should be :

<customers>

  <customer>

      <city>NY</city>

  </customer>

  <customer>

      <city>Others</city>

  </customer>

</customers>

Outcomes