Photo by Lenin Estrada on Unsplash | Multiple Rooms in Coda → Part 3

Multiple Rooms in Coda → Part 3

Booking the room and update your ‘stock’

Christiaan Huizer
5 min readApr 27, 2022

--

In my previous blog I showed how via a single button we move selected days towards a table where we can select the combination of our liking. This is the step 3 in the below image.

We assume you can only select one combination per day. To avoid any manual select and deselect confusion, we created a set up that results in only one possible selection, always the last one. This to avoid a situation like below:

Two combinations active per day is not what you want

We achieve this by automatically deselecting the previous selected row. This the result of using two times the ModifyRow logic. First we deselect all values using ThisTable.CheckBox . The thing is, you only want to do this specific date, not for all dates in your list. This sub set we get via a filter. Below how this solution looks

Combine two forms of ModifyRows() and a filter

This is an often applied and practical solution to avoid mistakes in a date driven multi select context. The down side is that you cannot deselect a previous choice by clicking on it and thus if you want to skip one day you have to start with a clean slate and here you use the button on top Reset My Choices

Next we want to move the selected rooms to the reservation table and take them out of the list of available rooms (our stock). We use a second (hidden) button that does a few things.

removing and adding the selected dates

The button only works if the checkbox is active and thus it only takes the values living in an active row which I colored green via a conditional format.

To add a row per room we need first to break open the combination and that we do by applying a virtual index as recently explained in this blog.

In the table with all rooms, we have them already stored per date and we have to remove them, which is — as you noticed — a bit more straightforward.

Once we have selected and removed the rooms, we also want to go somewhere in our doc. I made the choice to follow the reservation logic. This is done via OpenWindow(). The link I copy via the three dots in front of the table and I shorten it a bit to make sure it still works once this doc is duplicated. The SwitchIf() is handy in this case for the function does not require a fall back option (when not true, then).

In the end you not only want to move rooms (and to add contact & other information) but also you want to keep track of who (re)moved which room and when.

Archiving & Tracking Movements

To keep it as simple as possible in the tables we manage and which never become very large due to the applied logic (we take a selection via dates and next sub sets of that) we add a button in each table that is pressed when the main action takes place and this button brings the data living in that row to a table and add the date, time and user to it. This DB Archive permits us — if one day needed — to understand what happend.

in our case we want to reference the tables we use. In Coda there is no direct way of doing so, but the trick below will do the job. We create a helper table and use the @ symbol to reference the table we have in mind in the column Name. It appears. In the next column (Value) we manipulate this bit of data in three steps. We turn it into text, we Slice it and to Slice it smart, we look for the first underscore. The code part we apply looks as below. Coda keeps track of previous names in their code base, so un update might not be directly visible in this table.

Getting dynamic names

Anyway, this logic permits us to reference any table in an action using the @ symbol, see below

we reference a table in an action via the @ logic

We also applied a like wise table logic for the actions we took

Together this results in a nice overview in our archive tabel.

Archive tabel referencing the tables via lookup column

I like clean tables.

Following Days

I almost forgot my intention to show how to make sure you can rent the same room a few days in a row. People don’t like to change rooms, that is for sure unless it is a serious upgrade. I’ll discuss a solution in part 4 together with some small CRM alike features like relating clients to rooms.

I hope you enjoyed this article. If you have questions feel free to reach out. Though this article is for free, my work (including advice) won’t be, but there is always room for a chat to see what can be done. Besides you find my (for free) contributions to the Coda Community and on Twitter

My name is Christiaan and I support SMB with calculations (budgets and planning) and I prefer using Coda to get the job done.

Not to forget: the Coda Community provides great insights for free once you add a sample doc.

Christiaan on: Multiple Rooms in Coda → Part 3

--

--

Christiaan Huizer

I write about Coda.io - AI and (HR )planning challenges. You find blogs for beginners and experienced makers. I publish about once per week. Welcome!