In the following code, the Property_Bookings form restricts bookings based on the Arrival and Departure dates for a specific property. For instance, if a booking is made for property named C54 between 1st and 9th Jan, the form validation should check if there is no other booking for property C54 between 1st and 9th Jan. The code is added to the Form Actions -> on add -> on validate block of the Script tab.
if (count(Property_Booking[((Arrival <= input.Departure && Departure >= input.Arrival)
&& Property == Sinput.Property)]) > 0)
{
alert "Booking DENIED - property already booked for the specific date ";
cancel submit;
}