Jump to content
  • 0

Best way to SUM up times?


iSay78

Question

Hi,

i really like Caspio bridge and looking forward to learn some more. For now I'm a bit stuck..

What would be best way to SUM up times?

I have times in column like this..

TIMES

2:23

7:56

11:05

..and I like to SUM these to get:

Total: 21:24

I have used calcFields in column to get my timeDiff. I know that Aggregate function for times is not possible for Summing times. I understand some basic java, but really dont know where to start or how to implement it in Caspio.

Could someone please give me a direction where to start and what really is the best way to go?

Thanks a lot!

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

It is complex to sum the time in DataPage level. It is possible by extra programming. But you need to get all the records' values, calculate them, and then display the results.

A simple workaround is to separate time field to two fields: one field for hours, another field for minutes. So there are two columns in the table

hours | mins

----------------

2 | 23

7 | 56

11 | 05

And then calculate them in the aggregate field. Please insert the following formula:

cast((SUM(hours) + cast(SUM(mins)/60 as int)) as varchar) + ':' + cast((SUM(mins) - cast(SUM(mins)/60 as int)*60) as varchar)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...