Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How to count the number of xml tags in tXMLMAP and calculate the sum

Hello,
I have an input XML file to a tXMLMAP, I have two outputs from the tXMLMAP component.
I defined two loops, one on <t1> and the other one on <TL> (as illustrated in the example below).
The loop works fine, one line per <t1> in table1 and one line per <TL> in table2.
In table1 i want to have a column containing the number of <TL> tags and an other column containing the sum of all the <TL> values, how can I do that in tXMLMAP?
with the data below, i would like to have in Table1:
t1, t2, 2,5
t3, t4, 1,4
and Table2:
t1, t2, tl1, 2
t1, t2, tl2, 3
t3, t4, tl1, 5
<root>
    <T>
       <t1>t1</t1>
       <t2>t2</t2>
       <TL service="tl1">2</TL>
       <TL service="tl2">3<tl>
    </T>
    <T>
       <t1>t3</t1>
       <t2>t4</t2>
       <TL service="tl1">4</TL>
     </T>
</root>
Best regards.
Sidi
Labels (3)
1 Reply
Anonymous
Not applicable
Author

You cannot calculate sums in the tXMLMap. You can only provide an output flow and components like tAggregateRow to calculate sums/counts etc.