1

In my data source I have records with XML content that I want to extract and duplicate rows :

Data Source

id | content 

100 | <?xml version="1.0" encoding="utf-8"?><RepeaterData><Version /><Items><Item><Years>2018</Years><data>110</data></Item><Item><Years >2019</Years><data>200</data></Item></Items></RepeaterData>

I want to get an out put like :

100 | 2018 | 110

100| 2019 | 200

which component could I use ? Any help please ?

user6479259
  • 47
  • 1
  • 9

1 Answers1

1

Here's how you can do it :

enter image description here

First, iterate on your rows, and for each row read the xml column and extract the fields you want from it using tExtractXMLField. Then inside the tMap retrieve the ID of the current row that was set by tFlowToIterate.

And the result :

.---+----+----.
|  tLogRow_1  |
|=--+----+---=|
|id |year|data|
|=--+----+---=|
|100|2018|110 |
|100|2019|200 |
'---+----+----'
Ibrahim Mezouar
  • 3,981
  • 1
  • 18
  • 22
  • Thank you iMezouar for your reply, I have a question plz : can I replace the **tFixedFlowInput** by a **tXMLMap** ? I have a flow before to iterate on rows I don't know how to match between my flow to get data and the **tFlowIterate** . – user6479259 Apr 17 '18 at 13:42
  • I'm not sure I understand your question, but the easiest way to do this is to first prepare your data and store it in a tHashOutput (that has an ID and XML columns), then in a 2nd subjob do what I suggested in my solution, by replacing tFixedFlowInput_1 with a tHashInput that reads the data you stored in tHashOuptut. This way you don't have to change a lot of things to get it working. – Ibrahim Mezouar Apr 17 '18 at 13:48
  • Happy to help ;) – Ibrahim Mezouar Apr 17 '18 at 13:58