Help with time booking logic

Hi guys! I need help with a show_if expression.

I have an app where users can fill in a booking form, among the form fields there is one for selecting a date and one for selecting a time. When the user submits the form selecting a date and time, if he tries to fill in again and selects a date that is within 7 days of his previous booking, he does not need to fill in the time field (I use show_if).

So, assuming I have reserved todayโ€™s date (10/22/2021), and then try to reserve any date between 10/22 and 10/29, I donโ€™t need to fill in the time field (in fact, the field shouldnโ€™t appear ).

I have a table where I record all reservations that contain time, I put the following logic in the show_if of the time field:
ISBLANK(FILTER(โ€œbookings_with_timeโ€, AND([Date]>=DATE([_THISROW].[date_to_book])-7,[Date]<=DATE([_THISROW].[date_to_book), [Email]=USEREMAIL() )))

This expression works sometimes. The idea is to filter the โ€œbooked dates with timeโ€ table, trying to bring up any row that: is from the userโ€™s email and the reservation date is within 7 days of the one he is selecting on the form. With the ISBLANK function I check if the filter has returned any value, if it has, the field is visible.

Has anyone tried something like this or have any tips?

0 7 218
7 REPLIES 7
Top Labels in this Space