IMPORTANT:
this is not a Support Forum! Experienced users might answer from time to time questions posted here. If you need a professional and reliable answer, or if you want to report a bug, please contact Altova Support instead.

Sub Totals Options · View
ExplorerMatt
Posted: Thursday, August 20, 2015 4:13:05 PM
Rank: Newbie

Joined: 8/20/2015
Posts: 2
Location: Leeds
Code:


Hi,

Im using the line below to get a grand total

sum(/XML/claims[*]/expenses/expense[*]/amount)

but I want to use something similar for sub totals

I have two sub records, so

sum(/XML/claims[1]/expenses/expense[*]/amount) gives me 20
sum(/XML/claims[2]/expenses/expense[*]/amount) gives me 0.99

and

sum(/XML/claims[*]/expenses/expense[*]/amount) gives me 20.99

But for the subtotals, I need something generic like

sum(/XML/claims[[b]ROWNUMBER[/b]]/expenses/expense[*]/amount)

Please help
Matt


island
Posted: Friday, August 21, 2015 4:52:19 AM
Rank: Newbie

Joined: 10/28/2002
Posts: 1,283
Location: AT
Hi,

I would suggest explaining exactly what ROWNUMBER is supposed to signify and also attaching your ".sps", ". xsd" and ".xml" files so that the context of the question is clear.



ExplorerMatt
Posted: Friday, August 21, 2015 8:51:06 AM
Rank: Newbie

Joined: 8/20/2015
Posts: 2
Location: Leeds
Hi Island/All

Please see the requested files here
https://kiteworks.explorer.uk.com/w/vqRaV2p8

Don't pay too much attention to "ROWNUMBER" at this point. I primarily want to get get the subtotals working - please could you take a look.

Kind Regards
Matt

island wrote:
Hi,

I would suggest explaining exactly what ROWNUMBER is supposed to signify and also attaching your ".sps", ". xsd" and ".xml" files so that the context of the question is clear.



island
Posted: Friday, August 21, 2015 10:16:00 AM
Rank: Newbie

Joined: 10/28/2002
Posts: 1,283
Location: AT
Hi,

instead of using an absolute path in your autocalc, simply use a relative path because the table is already in the "claims" element:

Code:
sum(expenses/expense[*]/amount)


This will then aggregate the amounts for each "claims" element..
Users browsing this topic
guest

Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Use of the Altova User Forum(s) is governed by the Altova Terms of Use.