Prevent form submission for conflicting date ranges

320
1
02-10-2023 07:24 AM
erica_poisson
Occasional Contributor III

Hi - 

I am building a new Survey123 form which will be used internally to my organization (not public) for reserving vehicles from a pool. I'd like to implement a way to prevent conflicting reservations on a per-vehicle basis. This would need to look at a date range (the span between the Reservation Start Date/Time and Reservation End Date/Time), in addition to the Vehicle Plate to determine if a vehicle is already reserved. If a vehicle is already reserved, then the user would need to modify their reservation. 

I am wondering if this is possible via either a custom JavaScript function (pulldata @javascript) or with the newer pulldata @layer function. 

Any assistance would be appreciated!

Thank you,

Erica
0 Kudos
1 Reply
erica_poisson
Occasional Contributor III

This is where I am at in my thought process now... if anyone has suggestions or insight into this, please let me know! Right now, the pulldata @ layer statement does not return anything. I will keep playing to see if I can figure this out. 

erica_poisson_1-1676296438050.png

What is returned in Connect when I test (my hosted feature layer has one record right now that I am testing against):

erica_poisson_2-1676296483357.png

 

 

Erica
0 Kudos