I have some non-ideal XML that I have to try to make a dynamic table out of …
(Sorry image data does not match up)
My thought was to repeat on one of the elements (paymentDate), and try to grab the corresponding element (paymentAmount). I hoped I could access the current index of the repeat, but that doesn’t seem to be working.
You could try to loop through the elements of PlanDetails.
Then inside the loop, extract each trio (paymentType, paymentDate, paymentAmount) via a script and populate the detailTable yourself.
It would be best to create the detail table PlanDetails in a previous Data Extraction before the loop with 3 empty fields already setup how you want them.
This can all be achieved easily with the proper XPATH selectors. You have to loop on all <paymentType> elements. When you extract the paymentType’s value, you simply use the “.” selector. Now in order to get the first following paymentAmount, you would use the “./following-sibling::paymentAmount” selector. For the paymentDate value, you’d use - you might have guessed by now - “./following-sibling::paymentDate”.
Obviously, this technique assumes the elements are ordered properly, exactly as if you had used an actual index.
Attached is a sample data mapping config that does just that: Siblings.OL-datamapper (3.4 KB)