The best way to store user availability

Hi all. I’m working on a management tool for our cleaning business here.

One of the features I want to integrate is user availability. I’m planning on allowing cleaners to specify their default availability for shifts. My design for this was to have checkboxes for every hour between 5am and 10pm for all seven days, and store the data in a single text field per day

So, for instance, if a user was available from 5am-10am every Monday, the data would look like this as a string:

111110000000000000

Or as an array:

0 => 1
1 => 1
2 => 1
3 => 1
4 => 1
5 => 0
…etc

The two challenges are:

  1. working out how to update this data in Glide with a nice user interface - I was designing a grid of checkboxes for this - but I don’t know if it’s possible to map multiple updates to a single field. I was hoping to use the ‘array’ field as a holder for this date.

  2. querying this data at a later date, to return available staff members.

I wondered if anyone had any experience with this kind of issue? I’d like to avoid adding 18x7 data columns if possible, this seems a bit overkill!

I would suggest exploring using a JSON structure. Glide has very good support for manipulating JSON.

1 Like

Oh, lovely stuff. I wasn’t aware of this - looks like it might be perfect. I’ll try this out and mark your answer as a solution if it works (and drop a quick explanation together too, for other users.) Thanks Darren!

2 Likes