Updating Time Tracking Table from Tasks View

Hi Glide Community,

I’m building an app where users can log time against tasks. I have three tables: Tasks, Users, and Time Tracking. Users should be able to start and stop time tracking on a task from the Tasks view. The time tracking entries are stored in a separate Time Tracking table.

Here’s what I’m trying to achieve:

  1. Start Tracking: When a user starts tracking time, a new row is added to the Time Tracking table with the task_id, user_id, and start_time. (This can be done with an Action on the button easily)

  2. Stop Tracking: When the user stops tracking time, the corresponding row in the Time Tracking table should be updated to include the end_time.

The challenge I’m facing is that in the Tasks view, I can’t directly set columns in the Time Tracking table. I’ve tried using relations and various workarounds, but still can’t get this working.

Does anyone have any suggestions or best practices for handling this kind of time tracking scenario in Glide? Any help or pointers would be greatly appreciated

  • Add a Query column to your Tasks table, target it at your Time Tracking table and apply two filters:
    — task_id is This row->task_id
    — user_id is User Profile->user_id
  • then add a Single Value column, target it at the Query column, and select First->Whole row

You should then be able to Set Column values via the Single Value column.

3 Likes

Amazing, that worked… mostly…! I still don’t really know how.

One constraint is that a user can track time multiple times on a task (so could create 3 or 4 time_tracking rows), but this is only updating the first row. The other constraint is that multiple users can track time on a particular task. I think your solution might cater for that, but I need to test.

You can add another filter to the Query so that it matches the row where the end time is empty.

And yes, it will work for multiple users.

:exploding_head: :exploding_head: :exploding_head:

Amazing, thank you Darren! Legend.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.