Author Topic: Need Time Based Sum In Aggregate Function  (Read 680 times)

vijay@spinetechnologies

  • Pro Enterprise
  • Jr. Member
  • *
  • Posts: 87
    • View Profile
Need Time Based Sum In Aggregate Function
« on: November 30, 2021, 11:28:31 am »
I would like to calculate Sum of time in (hh.MM) format

Work Hours
10.30
01.45
02.30

Total Work Hours : 14.45

How I can achieve it. Kindly guide us

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Need Time Based Sum In Aggregate Function
« Reply #1 on: November 30, 2021, 03:43:51 pm »
You would need to write a custom aggregate.

Here is the example of custom aggregate: https://paramquery.com/pro/demos/group_rows_custom_summary

Code: [Select]
agg.sumdate = function(arr){
//arr is array ['10.30', '01.45', '02.30']
arr.forEach(function(val){

});
return sum_of_hr_and_min;
}

Please let me know if you need help with logic of the method.