# Adding up total time from individual time spent entries

Hi
I have a database for tasks with associated entries for time spent on tasks which is calculated using the time picker and working correctly.
I am looking to sum up the time a user has spent doing tasks, the information I am working with in the DB is task, created by and user (this is task creator), and time spent. The tasks are associated with a project.

Any help would be greatly appreciated. For reference I have attached a screenshot of the DB table.
Thanks

For where you want to display the total time:

Display as text (Do a search for tasks where user/creator = current user and project=current project or whatever you want):each item’s time spent:sum. This will display the total minutes.

Now, perhaps you want to display it as HH:MM. You need a bit of math to sort this out. To calculate HH, run the same search as above / 60:floor. This gives us the total hours rounded down. To get MM, run the same search as above ← modulo → 60. This gives the reminder of the above calculation. Separate these two dynamic values with a : to give the HH:MM.

However, when the minutes is 1-9, it will display 1:9 instead of 1:09 for example. To fix this, add a conditional that changes the text when the search’s ← modulo → 60 < 10 and add a text 0 after the colon.

Thank you so much George that worked perfectly for the hrs.

I have copied the expression
‘Search for Project Tasks:each item’s Time Spent:sum/60:floor<-modulo->60’ but i am not getting minutes now

i am getting the decimal point like the following

You shouldn’t have /60:floor for the minutes expression.

We want Search:sum ← modulo → 60. This means take our search, sum all of the minutes, divide by 60 and output the remainder.

It seems to be adding the extra 20 minutes in the second expression

Could you show both the expressions for the 0:20 and Minutes text?

Ensure all of your search constraints are correct too e.g that all searches are filtering only for current user and current project.

Here they are, thanks George.

Btw where did you learn expressions from, was it a case of learning by fire or is there a specific manual video you would recommend?

yes there was a mistake in the filter, its fixed now, thanks very much george

I am not really a Bubble expert or anything. I built two (of the same) app prototypes and am now working on my third which should hopefully be a product (it’s an aviation group management system). I created the first two just to learn how it all works. I learned by doing. Buildcamp courses are great, and Youtube is your friend. The forums are also good - for every question I ask I try to answer at least a couple of others so that I can pay it forward.

1 Like

i definitely intend to do the same thing once i have enough knowledge. Big fan of buildcamp too.

This topic was automatically closed after 70 days. New replies are no longer allowed.