4 Replies Latest reply on Feb 16, 2016 12:00 PM by DavidGunter

    calculation or script to determine if already booked

    DavidGunter

      My house rental reservation program needs a calculation or script to determine whether a query for a date range at a rental property is already booked. The reservation table, indicates renter ID, arrival and depart dates as seperate fields, and at which property from a value list.

       

      The missing step is to block a new reservation that conflicts with an existing one. I'm thinking a script, a conditional or a validated calculation would do the trick but do not know how to construct it. A dialog indicating ' dates are not available' would be ideal. Any ideas?

        • 1. Re: calculation or script to determine if already booked
          siplus

          There's an interesting preliminary consideration to be made about this. Let's say that house A is booked for a week, 1 to 7 August, and you get a phone call from a customer that wants to book it for a whole month, from July 30 to August 30.

           

          You might want to give preference to the new client, put him on hold, call the old client and try to convince him into getting another house. 

           

          I'm trying to say that before coding one should ponder whether to spit a "not available" message or to offer some more useful information.

          • 2. Re: calculation or script to determine if already booked
            DavidGunter

            Tnaks Siplus - Well, that is a complication I think that could be handled on an ad hoc basis. I'm still trying to understand how to construct the basic query.

            • 3. Re: calculation or script to determine if already booked
              siplus

              booked period

               

              ---------------------------[wwwwwww]----------------------------

               

              wanted periods:

               

              1-----[wwwww]------------------

              2--------------------[wwwww]--------------------

              3-------------------------------[ww]-----------------

              4----------------------------------[wwwwww]-----------------

              5------------------------------------------------------[wwwww]----------------

              6----------------[wwwwwwwwwwwwwwwwwww]-------------

               

              1 and 5 are OK, the rest are not

               

               

              loop on every existing booked period for a house, having BookingEndDate > Get(CurrentDate), and check for conditions 1 to 6, add up a local var if 2,3,4,6 happen, at the end if the local var is still 0 you can book with the desired dates.

              • 4. Re: calculation or script to determine if already booked
                DavidGunter

                Thanks for that Siplus. Using 2 local variables for both property and date,  I worked out one script that finds all reservations that end using get(current date ) for any of the properties that works from any reservation page. Drove me a little batty at first because the properties were listed in a popup menu. After I changed it to a drop down it worked!

                 

                But how do I set up the comparison to find the conditions you indicated?