AnsweredAssumed Answered

Buggy script needs a tweak!

Question asked by DavidGunter on Mar 18, 2016
Latest reply on Mar 20, 2016 by dtcgnet

Starting with a script that matches query reservation dates  with all existing reservations in all rooms, and returning ‘available’ for every reservation that does not conflict, the script produces an accurate list of matches ruling out those that conflict. The ones that do NOT conflict are labelled ‘available’ in a field.


But the second script, meant to return just one instance of each room to expedite booking,  needs debugging.


Script 2


Perform Find(Reservation:testcurrentdate=”available’)


//eliminates conflicts already found in first script, returning all date sets that are "available"


Sort Records


// places duplicate kf_propertyID found in first script records adjacent



         Set Variable [$PR: Value:Reservation::kf_propertyID]

         Go to Record/Request [Next]

         IF [Value:Reservation::kf_propertyID=$PR]

                  Omit Record

                  Go to Record/Request/Page //


         End IF       

         Go To Record/Request/Page

         [Next:exit after last]


End Loop                    // the idea is end up with only one kf_propertyID that is also 'available'


But  the script fails to omit one duplicate or leaves out one room entirely that is ‘available’. Otherwise it works.


Any help is greatly appreciated.