I want to Calculate Timespent automatically, Is there a way to do this without any code
Hi I am not a developer, I want to Calculate Timespent automatically, Is there a way to do this without any code. For a project management, our deliverables have timesheets. I want to calculate time spent with the help of start date and end date & time field. Is there a way to calculate this ?
Would be helpful If you could share some more details of your app setup and your needs.
Yes the Start Date and End Date are two different fields with time
Based on the state date time and the end date time I want to calculate how long it took to complete the deliverable which should give me the duration
Even if its in the deliverables app it is fine, as then I can shoot that calculation into the timesheet app for further calculation.
Can you guide me here please.
you can calculate the time spent in the time Timesheet app and then sum the duration of all timesheets for a deliverable in the deliverables app. Create a calculation field in the Timesheet App and call it eg. "TimeSpent":
var start = moment(@startDate); var end = moment(@endDate); var unit = "days"; end.diff(start, unit)
You can change the unit as you like it: e.g. to "hours" or "minutes". That counts calender days. If you want workdays only , you'll find a solution here, where I've posted a code for calculating the duration in business days https://help.podio.com/hc/communities/public/questions/202828487-Calculating-workdays?locale=en-us
You can copy it, only ypur date field names into the variables at the beginning.
For summing all Time spent entries for one deliverable create a calculation field in the Deliverables app with:
@sum of TimeSpent
For that the Time spent app must be related to the deliverables app via a relationship field (I assume that you already have that relationship field in the Timesheet app).
NB: The result of this calculation is an integer. That means for your example
My Start Date is 14/04/2015 4:00 PM
My End Date is 14/04/2015 7:00 PM
- in case of using "Days" as unit result = 0 (exact result is 0.13 days)
- in case of using "hours" as unit result = 3 (exact result = 3.00 hours)
But if end date is 7:30 you also will get the result 3 (hours; exact result would 3.5 hours).
So if you want the exact result with decimals take a the next smaller unit and devide it like
var unit = "minutes"
end.diff(start,unit)/60 // result = 3,5 hours (for end date 7:30 PM)
var unit = "hours"
end.diff(start, unit)/24 // result = 0.13 days
Please sign in to leave a comment.