Hi,   I would like to build a table booking system and now I am writing the XpathCnstraint on how to avoid repeated booking   Is this correct or what does it mean  [(StartTime <= $NewReservation/EndTime and EndTime >= $NewReservation/StartTime)]
1 answers

What you're retrieving here is any record from the database for which the starttime is smaller than (or equal to) the endtime of the new reservation, and the end time is later than or equal to the starttime of the new reservation.


You can picture it like this (because drawing or writing it out helps picture what's going on exactly, and when it goes right or wrong)



Right now, it seems like your xpath would return cases 2, 3, 4, 5, 6, and 7. However, case 2 and 7 should likely not be returned as they don't actually overlap, they're just directly before or after your new reservation. For that reason, I believe it should be > and < instead of >= and <=.