Working with Hosted Feature Service - Restrict duplicate entries for Reservation

321
0
04-04-2022 07:58 AM
KristinThorpe1
Occasional Contributor

Hello all! I have been struggling with this same problem for a few weeks and I need help finding a solution. I have built a survey and web app in Experience Builder for people to reserve pavilions in the town park. My survey has fields for the Pavilion (select_one), Reservation Date (date), Reservation Time (select_one: 10 am - 2 pm, 2 pm - 6 pm, 6 pm - 10 pm, or 10 am - 10 pm), and contact information.

There is one major issue: There needs to be some sort of error or restriction so people do not double book the same pavilion for the same time frame (or if a pavilion is already booked 10 am - 10 pm).

I originally used pulldata() and wrote a JavaScript to connect to my feature service and count the records with matching pavilion, date, and time from the user selection; if the count > 0 then it tells the user to select again. I finally got that working only to realize I can't use JavaScript in a public survey.

Instead, I used the search() to generate a select_multiple list of Reserved Times from my feature service by filtering by the Pavilion and Date survey selections. My thought was, if I select all times that are already selected, to use a constraint on my survey Time selection where the Search Time != Survey Time. The issue with this is I can not default select only the filtered Time choices. The selection also needs to be dynamic and recalculate when the user selects another pavilion or date.

Any suggestions on how to not double-book pavilions is appreciated! This survey will be public and should be as user friendly as possible. Thank you!!

0 Kudos
0 Replies