AnsweredAssumed Answered

Nested XML to Flat File

Question asked by piyush.e.singh on Jun 21, 2017
Latest reply on Aug 25, 2017 by stindall320549

I have a requirement of converting nested xml to flat file. I tried using data process to split but not getting the desired output it needs to iterate for the same employee till the gets all the EffectiveDate and Percentage of each employee.

 

O/P should be 

1*XYZ*ASD*2017-02-22*1*4050*549*4034

1*XYZ*ASD*2016-02-22*10*4050*549*4034

1*XYZ*ASD*2015-02-22*7*4050*549*4034

2*ABC*FGH*2017-02-22*15*3050*349*3034

2*ABC*FGH*2016-02-22*20*3050*349*3034

 

XML file looks liks this.

<?xml version="1.0" encoding="UTF-8"?>
<Employees>
   <Employee>
      <ID>1</ID>
      <FirstName>XYZ</FirstName>
      <LastName>ASD</LastName>
      <Events>
         <Event>
            <EffectiveDate>2017-02-22</EffectiveDate>
            <Percentage>1</Percentage>
      </Event>
      <Event>
         <EffectiveDate>2016-02-22</EffectiveDate>
         <Percentage>10</Percentage>
      </Event>
      <Event>
         <EffectiveDate>2015-02-22</EffectiveDate>
         <Percentage>7</Percentage>
      </Event>
   </Events>
   <PayComponent>
      <BaseSalary>4050</BaseSalary>
      <HRA>549</HRA>
      <VariablePay>4034</VariablePay>
   </PayComponent>
 </Employee>
<Employee>
   <ID>2</ID>
   <FirstName>ABC</FirstName>
   <LastName>FGH</LastName>
   <Events>
      <Event>
      <EffectiveDate>2017-02-22</EffectiveDate>
      <Percentage>15</Percentage>
      </Event>
      <Event>
           <EffectiveDate>2016-02-22</EffectiveDate>
         <Percentage>20</Percentage>
      </Event>
     </Events>
     <PayComponent>
      <BaseSalary>3050</BaseSalary>
      <HRA>349</HRA>
      <VariablePay>3034</VariablePay>
      </PayComponent>
      </Employee>
      </Employees>

Outcomes