I want to create validation for room selection

I have 2 tables: meeting_request and VenueRooms. VenueRoom lists all of the rooms. meeting_request has 3 columns: start_time showing the start date and time of a meeting, end_time showing the end date and time of a meeting and room_assignment which uses foreign keys to link to VenueRooms and show the room each meeting is in. I have a form that allows me to edit a meeting's start date and time, end date and time and room assignment. I want to make a validation error that will tell me when i select a date and time that has already been assigned to a room. So if Meeting 1 is already assigned to Room A from 12:30PM - 1:30PM on 09/12/2023, I will receive an error message if I try to assign Meeting 2 to Room A from 1:00 PM - 2:30PM on 09/12/2023.

@Liz_Soolkin Welcome to the community.
Hard to say how to do it because there are a lot of ways this can be done.
It depends on how the form is constructed, and what kind of fields you are using. You can by way of logic, disable a selection if the venue is already taken at a specific time?
Select time and then check venue and if taken, disable that selection... there are other ways as well... best chances for you to find a solution here is to post a lot more detail, code, and screenshots.

1 Like

Thanks for the response! The form is pulling from a Joint Table (table1). I'm attaching a screenshot of the query (Join_mr_Conf_Venue_City_Usage) that table1 pulls from. The query pulls from multiple tables in the Retool Database.

Screenshot 2023-09-12 at 12.04.41 PM

So, if the rows can be edited, you could use a check if the change/selection is already included within the Meeting Requests table then notify user that the time is not available or disable the time selection in the edit form. You could check by using the following when a selection is made
{{meetingRequestsTableName.includes('start time.value')?notifyUserHereOrDisableTheselection:AllowtheValueStartTimetobeselected}}

Would you recommend adding that to a custom validation rule? If so, I'm receiving this error message.
Screenshot 2023-09-12 at 2.11.22 PM

{{**meetingRequestsTableName.data.**includes('start time.value')?notifyUserHereOrDisableTheselection:AllowtheValueStartTimetobeselected}}

forgot to add .data

so now it looks like this - {{table1.data.includes('start time.value')?notifyUserHereOrDisableTheselection:AllowtheValueStartTimetobeselected}}
but i'm receiving the attached error message? Should I be replacing "AllowtheValueStartTime" with something else?
Screenshot 2023-09-12 at 2.28.16 PM

You should be adding in the names of your fields and not literally what I wrote.

You mean something like this? {{table1.data.includes('dateTime9')?notifyUserHereOrDisableTheselection:Allow('dateTime9')tobeselected}}

1 Like

{{table1.data.includes('dateTime9.value')? utils.showNotification()see instructions:dateTime9.seetDisabled(false)}}
You're going to have to check the start and end times that are available.

Difficult for me to give very specific direction here unless you want to export the app and share it along with the data and even then I cannot do it all for you....I don't have the time - keep trying and you will get there....

1 Like