Given an XML node like: <Topics>["1;2", "4;1"; "87;4"]</Topics>
is it possible to create a detail table of 3 elements, each with two properties the first and the second value of each element?
DetailTable[1]:
1
2
DetailTable[2]:
4
1
DetailTable[3]:
87
4
I’m trying to fiddle with a repeat step and an extraction step with no avail, maybe I should instead use an Action script with only javascript commands?
The attached DM Config should do the trick.
It reads the array inside the Topics element and loops on its length. Inside the loop, it splits each element on the semi-colon, creating Element1 and Element2 for each detail record.
list= data.extract('./elementList[1]');
jLista = JSON.parse(list)
for (let[i, el] of jLista.entries()){
left = el.split(';')[0];
right = el.split(';')[1];
record.tables.ElementLists.addRow( {left: left, right : right } )
}
I’d like to follow up on the example. Could you elaborate why a go to step is required and settings the repeat step collection to ./Topics doesn’t work?
OK you caught me: I was just lazy and didn’t want to have to specify //root/Topics everywhere. Using the Goto step allows me to just specify . as the current element.