hotel reservation

Hi guys , 

i have create an app for hotel reservation but i have a problem on filtering the table camere . 

i have a table reservection with following row :

table reservection

start , fine , and select rooms

rooms

id , title 

peppemigl_2-1683464599372.png

 

 

if I insert a reservation from 7 to 10 May for the double room 101 in the next reservation from 7 to 10 May it must not give me the possibility to select the double room 101.

how can I do ?

 

 

Solved Solved
0 9 442
1 ACCEPTED SOLUTION

Hello there @peppemigl,

First I suggest you create a slice for your "Reservations" table, with these conditions:

AND(
 [data di retorno]>=TODAY(),
 [Status]<>"finished"
)

If the reservation ends in a date anywhere from today to the future that means it is a reservation that must be considered, and [Status]="finished" is just in case that's what your enum column is for, for storing the status of the reservation such as reserved, occupied, finished, etc. 

Let's call that slice "Booked Rooms".

Now we need to get you a list of rooms that are available to book for your clients, and we'll do this using the date range you write in the form, your complete list of rooms, and the new slice we just created.

Add this as the suggested values for the [selezione camera] column:

Rooms[id]
-
SELECT(
  Booked Rooms[seleziona camera],
    AND(
      [_THISROW].[data di arrivo]<=[data di retorno],
      [_THISROW].[data di retorno]>=[data di arrivo]
    )
)

This finds any conflicting reservations, takes the rooms reserved and excludes them from your total list of rooms, what is left are the rooms available to rent, please change the table names to the correct ones before testing.

I used the logic from https://stackoverflow.com/a/325939 for creating the date comparison expression.

View solution in original post

9 REPLIES 9

Hello there @peppemigl,

First I suggest you create a slice for your "Reservations" table, with these conditions:

AND(
 [data di retorno]>=TODAY(),
 [Status]<>"finished"
)

If the reservation ends in a date anywhere from today to the future that means it is a reservation that must be considered, and [Status]="finished" is just in case that's what your enum column is for, for storing the status of the reservation such as reserved, occupied, finished, etc. 

Let's call that slice "Booked Rooms".

Now we need to get you a list of rooms that are available to book for your clients, and we'll do this using the date range you write in the form, your complete list of rooms, and the new slice we just created.

Add this as the suggested values for the [selezione camera] column:

Rooms[id]
-
SELECT(
  Booked Rooms[seleziona camera],
    AND(
      [_THISROW].[data di arrivo]<=[data di retorno],
      [_THISROW].[data di retorno]>=[data di arrivo]
    )
)

This finds any conflicting reservations, takes the rooms reserved and excludes them from your total list of rooms, what is left are the rooms available to rent, please change the table names to the correct ones before testing.

I used the logic from https://stackoverflow.com/a/325939 for creating the date comparison expression.

Hi Rafael ... thank you very mutch ... I've been freaking out for days

i need to fix only this error when i click on update 

peppemigl_0-1683487065287.png

 

 

 

the sync problem is caused by the formula.

why? 🤔

I haven't used AppSheet database yet, but if the expression provides you with a correct result, which is a list of ID's of rooms to choose from, and you choose one, and you save the form, and it returns an error I don't think it could possibly be because of the expression, because all it does is make the list for you, and once you pick from it its job is done.

As it is a preview feature it might have unexpected issues, this might be one of them.


Hi Rafael ,

i have set an error row on table rooms.

I try and now everything works perfectly.

Thank you so mutch!😊

No problem, I'm glad it works, please don't forget to mark the relevant answer(s) as a solution so that maybe someday if someone has the same question as you did it might be easier for them to find it.

Hey there! It's awesome that you've created a hotel reservation app. 😊 For filtering rooms, consider using the Miami where to stay criteria as a reference to help users find their ideal accommodations in the area. Good luck with your app development!

For filtering the 'table reservection,' are you using SQL queries or are you using a different method to filter your data? Your question is a bit vague, but SQL could be a straightforward way to filter rows based on the 'start,' 'fine,' and 'rooms' parameters.

And it sounds like you're diving into the exciting world of app development for hotel reservations. That's awesome! Filtering tables can indeed be a challenging but crucial feature, especially when you're dealing with something as important as room reservations.


Just to throw in an example for inspiration, Novotel Surfers Paradise does an excellent job at making their room options and availability clear and easy to filter through on their website. When you search for accommodation near me in their area, their system sorts things quite efficiently, and perhaps you could get some UI/UX ideas from there.

Top Labels in this Space