AnsweredAssumed Answered

Groovy Script

Question asked by sunilhk437363 on Jul 5, 2018
Latest reply on Jul 9, 2018 by trey.yeager826393

Hi All,

 

i am mapping from xml to database... database profile which contains StudentName,StudentId,Address.. which i am passing it as input through set property to data process shape. In data process  i need to create a groovy script 

i need to create an ArrayList and check whether the data which i am passing is present in the list or not... if the data is present then i should append  only the StudentName with comma seperated to that particular record , if the data is not present then add it to the Arraylist.

Ex: input:

<StudentInfo>

<Student>

<StudentName>abc</StudentName>

            <StudentId>123</StudentId>

            <Address>xyz</Address>

</Student>

<StudentName>abc</StudentName>

            <StudentId>123</StudentId>

            <Address>xyz</Address>

</Student>

</Student>

<StudentName>pqr</StudentName>

            <StudentId>12</StudentId>

            <Address>lmn</Address>

</Student>

</StudentInfo>

 

output :

abc,abc|123|xyz

pqr|12|lmn

  

 

 

Outcomes