Setting up Timesheet with Multiple Breaks

As the title says I am working on a Timesheet “app”. What I am really trying to do is create a simple to use Sleep Training workbook for parents of infants. I would love some advice on how to best structure the docs. My traditional approach of creating a “log” of every event has been challenging and it is clear that this isn’t the right approach.

Looking at excellent examples from the templates:

It seems clear that instead of a row for every event (Example Sleep Session: Start Nap, Check, Asleep, Wake up, Asleep, Wake Up, End Nap) I should create a single row for each sleep session? The challenge I am having is that each session can have an indeterminate number of events.

Attached is an example of my current pure logs of events.


I need to be able to calculate duration of total sleep, which is measured by the sum of the periods between Asleep and Awake between “Start Nap” Or “Start Night Sleep” and “Out of Crib”.

Ben’s approach in the second example is really elegant. I am wondering how you would approach nearly the same example but essentially including the ability to take multiple “breaks” per day. Ideally with the ability to pause and resume from a single button which would allow calculation of awake to asleep in my use case.

Could you drop a data sample here? (you can use Share --> Embed)

Not sure this quite matches your schema, but here’s an approach:

2 Likes

Embeded Doc:

I have all the individual events due to trying to create a workbook that would be applicable to multiple types of infant sleep training. For now I am simply working to calculate “Total Duration Asleep” on a per nap/sleep session basis.

1 Like

Got it. Did my example help?

1 Like

Extremely helpful! I think that is exactly what I needed. Looks like all I need to do is slightly modify the sleep actions and i’ll be able to track everything I need!

I really appreciate the help. Can’t wait to play with it a bit more. My current “system” was needing to have multiple timers running to track how long baby was crying, how long she was asleep, if when she was crying I was supposed to pick her up or allow her to continue crying until a predetermined time.

@shishir

In the Section of this embedded doc named “02/23/19 Text control box for search”, you use the Format() formula like this:

Format("{1} {2} {3}", [Full Name], Role, Manager)

Why/when would that be preferred over this?:

Concatenate([Full Name]," ",Role," ",Manager)

What are the pros/cons of these two approaches?

I ask because I frequently use Concatenate(), and wonder if there are compelling reasons to instead migrate toward using Format().

Mostly personal style preference.

Format allows reusing an input multiple times (e.g. Format("{1} {1}", variable)), supports a few additional formatting options (e.g. Format{"1:0.00", 1/3} will give a formatted number) , and is slightly more reliable on retaining formats (e.g. when putting dates into strings).

1 Like

Finally had a chance to play with it. I think the biggest learning (separate from the format around event states) was your If + Filter + Sort combo
If([Is a “woke up” event?], thisTable.Filter(Time<thisRow.Time and [Is a “went to sleep” event?]).Sort(true, Time).Last(), “”)

This made it really easy for me to translate into my current format:
IF(thisRow.Action=Awake, thisTable.Filter(Time<thisRow.Time AND Action=Asleep).Sort(true,Time).Last(), “”)
which I can easily compute duration against for total sleep time.

Great! Glad to hear it :slight_smile:

Figuring out how to find the “previous relevant row” in these types of scenarios is generally the key.