# aggregation not working

**URL:** <https://forum.servoy.com/t/aggregation-not-working/15639>\
**Category:** Classic Servoy\
**Created:** [March 8, 2012, 5:22pm UTC](https://forum.servoy.com/t/aggregation-not-working/15639 "2012-03-08T17:22:59Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![poyel](https://avatars.discourse-cdn.com/v4/letter/p/e79b87/32.png) [@poyel](https://forum.servoy.com/u/poyel)\
**Post date:** [March 8, 2012, 5:22pm UTC](https://forum.servoy.com/t/aggregation-not-working/15639/1 "2012-03-08T17:22:59Z")

</div>

Hi guys,

I have found a problem on some aggregations function (count and sum).  
I have a formA based on tableA. In formA there is a SplitPane that contains two forms formB (tableA) and formC (tableA). formB and formC have relationname’s property set to tableA\_to\_tableA.  
On tableA i have created an aggregation function on field1 (for count) and an aggregation on field2 (for sum) and put them in the formC. When, in formB, i add a new record in formB (and save in the beckend db) the aggregation field is always empty, but i would to display the number of the record that i create and the sum of the field2.

Anyone know why?  
I hope that is all clear. (and sorry for the bad english)

Regards,

Marco Alessio Milazzo

---

<div class="post-metadata">

**Author:** ![rgansevles](https://avatars.discourse-cdn.com/v4/letter/r/3d9bf3/32.png) [@rgansevles](https://forum.servoy.com/u/rgansevles)\
**Post date:** [March 13, 2012, 7:41pm UTC](https://forum.servoy.com/t/aggregation-not-working/15639/2 "2012-03-13T19:41:08Z")

</div>

Marco,

The aggregates are on the related foundset tableA\_to\_tableA from the record of tableA on formA.

I guess you are mixing up the source and target for the relation (being the same table in your example), it seems you are using the aggregate from the related record instead.

If you put related tableA\_to\_tableA.count\_field1 on formA, I expect it will show.

Rob

---

<div class="post-metadata">

**Author:** ![poyel](https://avatars.discourse-cdn.com/v4/letter/p/e79b87/32.png) [@poyel](https://forum.servoy.com/u/poyel)\
**Post date:** [March 14, 2012, 8:17am UTC](https://forum.servoy.com/t/aggregation-not-working/15639/3 "2012-03-14T08:17:30Z")

</div>

I will test your solution.

Thanks

---

<div class="post-metadata">

**Author:** ![poyel](https://avatars.discourse-cdn.com/v4/letter/p/e79b87/32.png) [@poyel](https://forum.servoy.com/u/poyel)\
**Post date:** [March 14, 2012, 9:10am UTC](https://forum.servoy.com/t/aggregation-not-working/15639/4 "2012-03-14T09:10:32Z")

</div>

I test your solution but when i add tableA\_to\_tableA.count\_filed1 as dataproveder of the field i obtain “unresolved dataprovider” warning.

---

<div class="post-metadata">

**Author:** ![poyel](https://avatars.discourse-cdn.com/v4/letter/p/e79b87/32.png) [@poyel](https://forum.servoy.com/u/poyel)\
**Post date:** [March 14, 2012, 12:03pm UTC](https://forum.servoy.com/t/aggregation-not-working/15639/5 "2012-03-14T12:03:13Z")

</div>

i see a strange behavior.  
If i create a new record on the foundset of the formA the aggregation not working, but if i perform foundset.loadrecord(…) the aggregation show the correct value and if i create a new record the aggregation is still update.

Anyone can explain this? ![:?]( "Confused")
