Summation of nodes with like values

Trying to find a simple way to sum nodes with same values.

for example

<data>
	<gldetail>
		<ACCOUNTNO><![CDATA[5200]]></ACCOUNTNO>
		<AMOUNT><![CDATA[275]]></AMOUNT>
	</gldetail>
	<gldetail>
		<ACCOUNTNO><![CDATA[5200]]></ACCOUNTNO>
		<AMOUNT><![CDATA[-475]]></AMOUNT>
	</gldetail>
	<gldetail>
		<ACCOUNTNO><![CDATA[5650]]></ACCOUNTNO>
		<AMOUNT><![CDATA[475]]></AMOUNT>
	</gldetail>
	<gldetail>
		<ACCOUNTNO><![CDATA[5650]]></ACCOUNTNO>
		<AMOUNT><![CDATA[525]]></AMOUNT>
	</gldetail>
</data>

I want to sum all amounts where accountno are the same. so the first two and last two would sum together and spit out the following

<data>
	<gldetail>
		<ACCOUNTNO><![CDATA[5200]]></ACCOUNTNO>
		<AMOUNT><![CDATA[-200]]></AMOUNT>
	</gldetail>
	<gldetail>
		<ACCOUNTNO><![CDATA[5650]]></ACCOUNTNO>
		<AMOUNT><![CDATA[1000]]></AMOUNT>
	</gldetail>
</data>

I know there is a math sum module that will total them but it doesnt compare, just blindly totals. Is there an easy way with a conditional or something to do this or does it have to be done in a script?

Hi Brent, this will require Java/PHP code.

If this is commonly done, you could build a subassembly that wraps your Java/PHP code to make it re-usable.

That is what I thought but I figured it was worth asking.

Thanks

Yep, always best to check here when in doubt!