AnsweredAssumed Answered

How to Split and Repeat Values within an XML Element using Groovy

Question asked by mounika.jayanthi042656 on Mar 22, 2017
Latest reply on Mar 24, 2017 by mounika.jayanthi042656

Hi Team,

The article which you posted for this query  How to Split and Repeat Values within an XML Element using Groovy is very helpful. But i have 2 looping tags (PHR_CODE and PHR_TEXT)

My input data is: GHS01:Danger|GHS02:Gefahr|GHS03:Danger|GHS04:Peligro for PHR_Code and PHR_Text

Based on the above input delimiter iterations, <E1BP1091PP> need to iterate <E1BP1091PH>

Could any one help me in complex looping action here.

 

<E1BP1077PR SEGMENT="1">
<NAME_CHAR>SAP_EHS_1023_094_SIGNAL</NAME_CHAR>
<DESCR_CHAR>Danger</DESCR_CHAR>
<CHAR_VALUE>CUST-N10</CHAR_VALUE>
<RECNO_ROOT>00001026</RECNO_ROOT>
        <E1BP1091PH SEGMENT="1">
       <RECNO_ROOT>00001026</RECNO_ROOT>
       <PHRASE>N10</PHRASE>
       <PHRLIB>CUST</PHRLIB>
       <E1BP1091PP SEGMENT="1">
                 <RECORD_NO>00000000000001113874</RECORD_NO>
                 <RECNO_ROOT>00001026</RECNO_ROOT>
                 <LANGU>E</LANGU>
                 <PHR_CODE>GHS01</PHR_CODE>
                 <PHR_TEXT>Danger</PHR_TEXT>
         </E1BP1091PP>
     </E1BP1091PH>
     <E1BP1091PH SEGMENT="1">
           <RECNO_ROOT>00001026</RECNO_ROOT>
           <PHRASE>N10</PHRASE>
           <PHRLIB>CUST</PHRLIB>
           <E1BP1091PP SEGMENT="1">
                 <RECORD_NO>00000000000001120878</RECORD_NO>
                 <RECNO_ROOT>00001026</RECNO_ROOT>
                 <LANGU>D</LANGU>
                <PHR_CODE>GHS02</PHR_CODE>
               <PHR_TEXT>Gefahr</PHR_TEXT>
          </E1BP1091PP>
    </E1BP1091PH>
    <E1BP1091PH SEGMENT="1">
               <RECNO_ROOT>00001026</RECNO_ROOT>
               <PHRASE>N10</PHRASE>
               <PHRLIB>CUST</PHRLIB>
               <E1BP1091PP SEGMENT="1">
                        <RECORD_NO>00000000000001120879</RECORD_NO>
                        <RECNO_ROOT>00001026</RECNO_ROOT>
                        <LANGU>F</LANGU>
                        <PHR_CODE>GHS03</PHR_CODE>
                        <PHR_TEXT>Danger</PHR_TEXT>
              </E1BP1091PP>
       </E1BP1091PH>
       <E1BP1091PH SEGMENT="1">
                  <RECNO_ROOT>00001026</RECNO_ROOT>
                  <PHRASE>N10</PHRASE>
                  <PHRLIB>CUST</PHRLIB>
                  <E1BP1091PP SEGMENT="1">
                             <RECORD_NO>00000000000001120889</RECORD_NO>
                              <RECNO_ROOT>00001026</RECNO_ROOT>
                              <LANGU>S</LANGU>
                              <PHR_CODE>GHS04</PHR_CODE>
                              <PHR_TEXT>Peligro</PHR_TEXT>
                  </E1BP1091PP>
          </E1BP1091PH>
</E1BP1077PR>

 

Adam Arrowsmith

Outcomes