Automatically creat and feed row

Hello,

Here I am back to the backend of my apps and trying to improve them a bit.

I have an app for hotel reservations for the tours we run, where each row is a date/night.
One of the columns is for the number of nights we stay in each hotel.
The plan is that, when we tell this one column that we are staying for multiple nights in a hotel, that the app automatically creates a row for each extra night (date).
It would be pretty much copying the row with the information for that hotel, other than the date!
So, if I say it is “2” nights, it copies that information to the row below it but with a different date. If I say “3” nights, it adds 2 rows and so on.

Is there a way to do this?

Thank you!

Hi Cabelo,

My suggestion would be to first explore whether it is possible to capture all of the data relevant for a given booking in single row, for example by creating both a Check In Date column and a Check Out Date column. This would likely be a better data schema than including an identical row for each night a user plans to stay.

AppSheet’s calendar feature allows you to associate a range of dates with a single line item. You can do this by creating a Calendar type view, navigating to UX, and setting the Start Date and End Date to the corresponding columns.

If you review this option and find that there is still a need to create separate rows for each night, you could likely accomplish this by setting up a workflow that upon detecting a new row entry will duplicate that row according to how many dates are in the range. The expression you could use for determining how many dates are in a given range would look something like this;

HOUR([Check_Out_Date] - [Check_In_Date])/24

1 Like

Thanks @Hayden
I like the suggestion, I will play with it. The reason why we had different rows is because sometimes during a 3 night stay, the cost of the room would be different (let’s say one of the nights was a Friday) or the number of people would change.
But your idea also solves so many other issues i had that it is worth trying.

Cheers

1 Like