# Problems with maximum aggregation

**URL:** <https://forum.servoy.com/t/problems-with-maximum-aggregation/1203>\
**Category:** Classic Servoy\
**Created:** [February 7, 2004, 2:46am UTC](https://forum.servoy.com/t/problems-with-maximum-aggregation/1203 "2004-02-07T02:46:28Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![DFehrenbach](https://avatars.discourse-cdn.com/v4/letter/d/c67d28/32.png) [@DFehrenbach](https://forum.servoy.com/u/DFehrenbach)\
**Post date:** [February 7, 2004, 2:46am UTC](https://forum.servoy.com/t/problems-with-maximum-aggregation/1203/1 "2004-02-07T02:46:28Z")

</div>

I have a table **billings** and a table **receipts** with a one-to-many relationship. Since there can be many receipts for each bill, I want to make a calculation field in **billing** that will show the last receipt payment date.

In **receipt** , I have an aggregation field cLastPayDate as the maximum of the receipt table field datepaid  
In **billing** file I have a calculation datetime field called cLastPaidDate defined as _return billing\_to\_receipts.cLastPayDate;_  
Is this the right way to do this? The field in the  
**billing** table is blank for all records.

---

<div class="post-metadata">

**Author:** ![IT2Be](https://avatars.discourse-cdn.com/v4/letter/i/dc4da7/32.png) [@IT2Be](https://forum.servoy.com/u/IT2Be)\
**Post date:** [February 7, 2004, 10:19am UTC](https://forum.servoy.com/t/problems-with-maximum-aggregation/1203/2 "2004-02-07T10:19:47Z")

</div>

What happens if you show the field in the/a receipt form. Is the value correct there?

Can you post the calculation you made?

---

<div class="post-metadata">

**Author:** ![DFehrenbach](https://avatars.discourse-cdn.com/v4/letter/d/c67d28/32.png) [@DFehrenbach](https://forum.servoy.com/u/DFehrenbach)\
**Post date:** [February 7, 2004, 2:46pm UTC](https://forum.servoy.com/t/problems-with-maximum-aggregation/1203/3 "2004-02-07T14:46:31Z")

</div>

No, the field in **receipts** table is blank.  
calc used in **billing** table is:

> var lastdate=billing\_to\_receipts.cLastPayDate  
> return lastdate;

.  
All of the other calculation fields in **billing** calculate correctly.

---

<div class="post-metadata">

**Author:** ![IT2Be](https://avatars.discourse-cdn.com/v4/letter/i/dc4da7/32.png) [@IT2Be](https://forum.servoy.com/u/IT2Be)\
**Post date:** [February 7, 2004, 3:56pm UTC](https://forum.servoy.com/t/problems-with-maximum-aggregation/1203/4 "2004-02-07T15:56:02Z")

</div>

Maybe you can check the ‘maximum’ aggregation with a number or integer value to see if/how it works?

Could be a bug or could be that date aggregations don’t work this way?

---

<div class="post-metadata">

**Author:** ![Jan\_Blok](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@Jan\_Blok](https://forum.servoy.com/u/Jan_Blok)\
**Post date:** [February 9, 2004, 3:30pm UTC](https://forum.servoy.com/t/problems-with-maximum-aggregation/1203/5 "2004-02-09T15:30:27Z")

</div>

Bug confirmed, will be fixed in Servoy 2.0 rc5

---

<div class="post-metadata">

**Author:** ![DFehrenbach](https://avatars.discourse-cdn.com/v4/letter/d/c67d28/32.png) [@DFehrenbach](https://forum.servoy.com/u/DFehrenbach)\
**Post date:** [February 9, 2004, 6:33pm UTC](https://forum.servoy.com/t/problems-with-maximum-aggregation/1203/6 "2004-02-09T18:33:03Z")

</div>

Thanks Jan!
