Sum of nested values

Hi,

I’m trying to create a TreeGrid where all of the parent nodes sum the values of its children. I can do that at the uppermost level but when I try to create another level of children below that, the sum stops working and so the results don’t bubble up to the uppermost parent.

What the grid does now:


What I was trying to do:


I need to be able to have this working to at least five levels, with the sums bubbling up to the uppermost parent.

Code for grid:

XML:

<?xml version="1.0"?> Account #1 10 20 =c2+c3
<row id='Account #2' accid="S118">
	<cell colid="a">Account #2</cell>
	<cell colid="aa"></cell>
	<cell colid="b">30</cell>
	<cell colid="c">40</cell>
	<cell colid="d">=c2+c3</cell>
</row>

<row id='Account #3' accid="S119" xmlkids='1' open='1'>
	<cell colid="a">Account #3</cell>
	<cell colid="aa"></cell>
	<cell colid="b"></cell>
	<cell colid="c"></cell>
	<cell colid="d"></cell>
	<row id='Account #3.1' accid="S120">
		<cell colid="a">Account #3.1</cell>
		<cell colid="aa"></cell>
		<cell colid="b">1</cell>
		<cell colid="c">4</cell>
		<cell colid="d">=c2+c3</cell>
		<row id='Account #3.1.1' accid="S120a">
			<cell colid="a">Account #3.1.1</cell>
			<cell colid="aa"></cell>
			<cell colid="b">30</cell>
			<cell colid="c">40</cell>
			<cell colid="d">=c2+c3</cell>
		</row>
		<row id='Account #3.1.2' accid="S120b">
			<cell colid="a">Account #3.1.2</cell>
			<cell colid="aa"></cell>
			<cell colid="b">30</cell>
			<cell colid="c">40</cell>
			<cell colid="d">=c2+c3</cell>
		</row>
	</row>
	<row id='Account #3.2' accid="S121">
		<cell colid="a">Account #3.2</cell>
		<cell colid="aa"></cell>
		<cell colid="b">2</cell>
		<cell colid="c">5</cell>
		<cell colid="d">=c2+c3</cell>
	</row>
</row>

Thanks

You may set a unique math formula for each cell right in your xml.
Here is the example:
=[[rowId,colInd]]+[[rowId,colInd]]
where
rowId - id of the row
colInd - index of the column