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?
Your expressions looks reasonable (though itโs missing a ]
, which I assume is a typo in the transcription). I would be helpful to know more about the bookings_with_time
table or slice, and about the date_to_book
column.
Hey Steve, thanks for your answer. Yes, it is just a typo.
The bookings_with_time is just another table that contains the same columns as the main table (which the form populates). But it only contains the booking records that had to select the time. Itโs not a slice, itโs just another table that an action populates if the user selects the time. I didnโt use a slice because in the future I intend to create unique columns for this table. The action works perfectly, so the reason the expression doesnโt work is not due to lack of record in this table.
About the field you mentioned, itโs just the date field that the user selects in the form, it has a different name from the field in the bookings_with_time table just to make the creation of expressions easier, but both contain the same data.
Can you share any observations youโve made about this behavior?
It work just for some users, I still donโt know why.
Donโt make any sense. I hope there is another logic I can use instead.
Iโm afraid Iโm at a loss, myself. Iโm going to have to refer you to Support so someone thee can take a deeper look.
Thanks Steve. I found out what happened: we put a security filter on the bookings_with_time table, but as some users didnโt pass the security filter, the expression didnโt return anything and always asked for the time selection.
We created the security filter because this table has a view with a show_if expression and we didnโt want some users seeing the data using a direct url to the view. There is any way to maintain the security filter, but that the expressions could do a bypass?
Not possible.
User | Count |
---|---|
41 | |
29 | |
22 | |
20 | |
15 |