My users can create a Job (such as ‘Fixing the sink’) and then time how many hours they worked on that job. They can start and stop the timer multiple times to generate a grand total amount of time, each ‘start/stop’ is called a Shift. However, I can’t see how to delete the grand total amount of time to reset the timer to 00:00?
The timer Start button looks like this;
When a user clicks ‘Reset timer’ I want to delete all the Shifts so the timer is zero.
Delete a Job's Shift isn’t working.
Any help appreciated.
Hi there, @darren.james7518… I took a look under the hood, and here are a couple of observations. First, I assume you know the workflow in the second screenshot is associated with the Text Save invoice to drafts element and not something called Reset timer. Second, I’m wondering if you need to use the Delete a list of things… workflow action, and the list of things to delete would be a search for shifts where the job equals
Anyway, I could be off base with that stuff, but I didn’t think it could hurt to throw those observations out there.
Hope this helps.
Thanks Mike, your solution was spot on!
First, I assume you know the workflow in the second screenshot is associated with the Text Save invoice to drafts element and not something called Reset timer .
Ah actually it was associated with the correct ‘Reset timer’ element but I had copy and pasted it and forgot to rename it that’s all, thanks for pointing that out.
I’m wondering if you need to use the Delete a list of things… workflow action, and the list of things to delete would be a search for shifts where the job equals
manage-job's Job .
This worked a charm. I thought of another idea, I could create three Option sets Status’s for the timer, ‘Recording, Stopped and Deleted’ and make sure the RG only shows Recording or Stopped Shifts (Deleted ones would not be displayed). So, I set this up as a test but it doesn’t work, even just making the ‘start’ button not visible when the Status is ‘Recording’ didn’t work.
It’s not vital as your solution worked, but out of interest I’d love to know where I am going wrong?
I created the Option sets.
I set the Status on the ‘start’ button to ‘Recording’ .
The ‘start’ button is visible on page load, but (should be) hidden when the Status is ‘Recording’ . The database shows the Status is saved but the ‘start’ button never disappears?
In the start button’s workflow, it looks like you have steps 1 and 2 in the wrong order. You are making changes to a shift in step 1, but the shift is being created in step 2.
Thank you @mikeloc, well spotted, I feel like I am getting worst at coding, missing things like this!
All works well now but the Status ‘Deleted’ only deletes the last shift entry (not all of them) so I think your first method is best.
Thinking about it, it may be better to use option sets because there could be a scenario where a user wants to retrieve deleted timed shifts, albeit a rare scenario.
Setting the status to ‘Deleted’ only removes the last shift from the RG, so I want to change all the shifts status’s in one go. I tried he following but Bubble is not likely the fact I’m trying to change a list of things.
Try getting rid of
:each item's Status, and you should see a button to change a field. Click the button and change the
Status field there.
Wait… what action are you using? If that’s not the Make changes to a list of things… action, well, it needs to be.
I edited my response while you were replying (didn’t realize you were replying)… read it again.
Ah yes, I have just changed it to Make changes to a list of things and I see the button and am able to set the status to ‘Deleted’ for the list … just going to test it now…
Works perfectly… thank you again.
I wasn’t familiar with Make changes to a list of things but it’s pretty cool and I do like using option sets in this way.