One word multiple meanings

Im doing a sleep diary. There are 3 types of sleep that a patient can enter, Sleep in Bed, Light Sleep and Unexpected Sleep. When the user enters the corresponding wake up event, Wake up, Wake from Light Sleep, Wake from Unexpected sleep, a calculation is performed to determine how long they were asleep for.

What Id like to do is change it so that they can just select Wake Up no matter the initial activity type but depending on the preceding activity Wake Up is changed to Wake from Light Sleep or Wake from Unexpected Sleep, to allow for the calculations to work.

Is there a way where I can make it change only when the entry prior has the event Light Sleep or Unexpected Sleep?

@benjamin.bm.andrews Could you please provide a screenshot of this please? Also, is this an option set that you are using?

Once I learn a little more about your specific scenario I can better answer your question! This should be possible using conditionals.

1 Like

This is the dropdown as it is
image
This is what comes out from the dropdown
image
the totals are how many hours sleep, in bed etc that are added up at the end of each day.

Yeah its an option set

1 Like

Thank you that was helpful and provided me some insight into what you are looking to do. I made a quick example and go over it in this video here: Forum: Conditional Option Sets | Loom

You can also check out the editor if you’d like: testApp42wCleanDB | Bubble Editor

Preview Page: NoCodeMinute Free Forum Help

Let me know if you have any questions!

Thanks for this mate. Im trying to get it the second option to work, that seems the most streamlined. I have an error and Im not sure what to make of it.
image

I’m assuming you store sleep type somewhere in the DB. If I’m right you can set conditionals in the Wake Up workflow: when sleep type is A wake up is A, when sleep type is B wake up is B and so on. Hope this makes sense.

I just did a quick loom to show you how its set up. Option 2 I thought I might be able to make work but the way the drop down works so that it goes into the DB is that its text and not really registering as a proper option set. If I change it to an option set and not be text as source then it breaks. So I looked at option 1 and that relies on the data still being in the dropdown but its submitted into the DB by that point, so I was wondering if there is a solution where instead of going to the drop down it goes to the DB and looks for the last entry details and works from that.

@benjamin.bm.andrews
I see what you’re saying. Here is a video going through that. In my example I add it all to one record but if you wanted to keep your DB schema the way you currently have it you should still be able to use the var - group in the hidden popup to help find the most recent sleep item.

Thanks mate, thats legendary. I love the way you have set that up. Is there any chance I can get the link to the editor thing so I can go through and remodel mine the same. Im having an error with the way Im calculating time in bed etc and this would bypass that error. Bubble are looking at it, but we arent getting overly far with it.

Again, thanks heaps for your help I really appreciate all the time you have put into this

1 Like

Not a problem at all! You should be able to see them with the links above ^^. Please don’t hesitate to reach out if you need any further assistance!

Thats worked a treat. I had to make some changes to get it to work for what I have but it works. With one issue. The time between start and finish of an event updates on the initial value not on each row as I go along. I did a loom video to explain better and show what Ive tried to do to fix it. I was hoping you could have another look and let me know your thoughts. Sorry, I feel like Ive leaned on you heaps with this process.

It’s getting there! The only thing off is the search you are doing on the make changes thing. It is referencing the hidden variable but the hidden variable search appears to be off. Now that you have the actioned field I’m not sure if you even need that variable you could most likely just do the search in the screenshot below. It looks like you were adding the conditional for the workflow but not applying that to finding the actual item.

Here’s a video too if that helps: ClickUp

You’re almost there!

Cheers mate, thanks for sticking with me. That seems to have sorted it out.

1 Like

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