Help

Problem with room occupancy

Topic Labels: Data
Solved
Jump to Solution
343 1
cancel
Showing results for 
Search instead for 
Did you mean: 
user2100
7 - App Architect
7 - App Architect

In the form I have a data record field where all free rooms are displayed. All occupied rooms are not displayed. However, if I have a reservation for the future, the assigned room is immediately marked as occupied even though it is still available until the specific reservation date. So far I have no idea how to solve the problem.

1 Solution

Accepted Solutions

Hello,

You could use a formula to check if the room is free "today":

Pascal_Gallais_0-1725881811947.png

Where the formula "free today" is:

 

IF(AND(DATETIME_DIFF(From,TODAY(),'days')<0,DATETIME_DIFF(TODAY(),To,'days')>0),"Yes",
IF(AND(DATETIME_DIFF(From,TODAY(),'days')>0,DATETIME_DIFF(TODAY(),To,'days')<0),"Yes",
IF(AND(DATETIME_DIFF(From,TODAY(),'days')<0,DATETIME_DIFF(TODAY(),To,'days')<=0),"No",
IF(AND(DATETIME_DIFF(From,TODAY(),'days')<=0,DATETIME_DIFF(TODAY(),To,'days')<0),"No"
))))
 
Using the formula "Today()" may not be a good option since it's being computed all the time and can hence have some consequences on performances.
This being said, I guess that you want to compare reservation dates with customer required dates, meaning that you will not need to use the "Today()" function.
 
Regards,
 
Pascal

See Solution in Thread

1 Reply 1

Hello,

You could use a formula to check if the room is free "today":

Pascal_Gallais_0-1725881811947.png

Where the formula "free today" is:

 

IF(AND(DATETIME_DIFF(From,TODAY(),'days')<0,DATETIME_DIFF(TODAY(),To,'days')>0),"Yes",
IF(AND(DATETIME_DIFF(From,TODAY(),'days')>0,DATETIME_DIFF(TODAY(),To,'days')<0),"Yes",
IF(AND(DATETIME_DIFF(From,TODAY(),'days')<0,DATETIME_DIFF(TODAY(),To,'days')<=0),"No",
IF(AND(DATETIME_DIFF(From,TODAY(),'days')<=0,DATETIME_DIFF(TODAY(),To,'days')<0),"No"
))))
 
Using the formula "Today()" may not be a good option since it's being computed all the time and can hence have some consequences on performances.
This being said, I guess that you want to compare reservation dates with customer required dates, meaning that you will not need to use the "Today()" function.
 
Regards,
 
Pascal