12 Replies Latest reply on Jul 30, 2009 9:03 AM by tcoyle

    Need Help with a script.

    tcoyle

      Title

      Need Help with a script.

      Post

      Ok here is my problem. I created a database for Booking Recording Studio sessions. I have a script that checks the Projects for double bookings. It checks the studios and  a field for date range. My problem is this. My studio names are A,B,C,AL,BL, and CL. Here in lies the problem when the script runs it keeps showing double bookings if there is a booking in Studio A and AL, or for that matter any Studio that starts with the same letter as another studio like B and BL, C and CL. When I go to my projects page and do a find just for bookings for a particular studio using the "" search. It indeed pulls any record with the searched data, ie "A". If I do a search using the =="" search, it then pulls ONLY the studio I am looking for. 

       

      Here is my script

       

       

       

       

      My question is this in the set field script is there a way for filemaker to look at the whole field or is it always going to just search by the first Letter? or is there a better way of doing the same thing another way? I know I could just change the rooms to be completely unique, but not quite what my client is looking for. It seems that if I can manually do the search correctly using the =="" search, some how I should be able to accomplish this within my script.

       

      thanks

       

      Tim 

        • 1. Re: Need Help with a script.
          RickWhitelaw
            

          Your script is not showing in your post. However,

           

          Enter find mode

          Set Field(==your text)

          Perform find

           

          Works fine. "your text" can be a variable or calculated value as well. The find will return only the exact match (AL as opposed to A and AL) 

          • 2. Re: Need Help with a script.
            tcoyle
               When I do that I get an error that a number, text constant, or a ( is missing. 
            • 3. Re: Need Help with a script.
              mrvodka
                

              I cant see your script either.

               

              Enter Find Mode []

              Set Field [ Studio; "==A" ]

              Perform Find []

               

               

               

              • 4. Re: Need Help with a script.
                tcoyle
                  

                by doing the "==A" won't that just search for Studio A. I need it to look at all the rooms that might be in the field named studio (which is a drop down list containing all the studios A,B,C,AL,BL,CL.

                 

                thanks

                 

                 

                • 5. Re: Need Help with a script.
                  mrvodka
                    

                  If you are trying to look for anything in that field then you canuse the wildcard.

                   

                   

                  Enter Find Mode []

                  Set Field [ Studio; "*" ]

                  Perform Find []

                   

                   

                  I am no longer sure what your question is.

                  • 6. Re: Need Help with a script.
                    tcoyle
                      

                    Lets see if this works for putting my script in here.

                     

                    http://farm4.static.flickr.com/3514/3771475427_b9f530471e_o.png 

                    • 7. Re: Need Help with a script.
                      comment_1
                        

                      It's a bit confusing, but I am guessing you want to use:

                       

                      ...

                      Set Field [ Projects::Studio; "==" & $Studio ]

                      ...

                      • 8. Re: Need Help with a script.
                        tcoyle
                           Hmm doing that pulls up ALL BOOKINGS for the particular studio. So it then gives me an error saying a room is double booked when there is not a session that day.
                        • 9. Re: Need Help with a script.
                          comment_1
                            

                          Yeah well, that's another issue. You are searching for duplicates in the DaysInRange field. You will find bookings for the particular studio that also have duplicate values in the DaysInRange field - but the duplicate values are NOT necessarily in records that belong to the SAME studio.

                           

                          If you want to do this by finding, you need a field that concatenates time slot and studio and search for duplicates there. Or do a self-join relationship matching on these two fields, and look for the existence of related records.

                          • 10. Re: Need Help with a script.
                            tcoyle
                              

                            How I have my script works fine except this new client has names of there studios that start with the same letter. See the date range field comes from a session start and end date. The double booking script checks for studios being used and then if there is a duplicate record with the same date range, it then gives the error, because then there is a double booking. It has to check for duplicates. I am getting double bookings right now even when there are NO duplicates in the date range field.

                             

                            thanks for all the help.  

                            • 11. Re: Need Help with a script.
                              comment_1
                                

                              tcoyle wrote:

                              How I have my script works fine except this new client has names of there studios that start with the same letter.


                              Well, then what exactly is the problem? You asked how to script an exact match find in the studio field. I believe this question was answered - you no longer get results for OTHER studios.

                               

                              If the results still don't match your expectations in terms of double bookings, it's NOT because of how you search the studio field. I happen to think that the logic behind your script is flawed, but it's very easy to find out if I am wrong: do the search manually, and see if the results make sense. If yes, do the scripted search, then do Modify Last Find and compare the scripted criteria to the manual ones.


                              • 12. Re: Need Help with a script.
                                tcoyle
                                   Thanks I will try that. I guess I am not explaining it correctly. Because I have built this Database 2 years ago with no issues with this script until this new client is using it with Studio's with the same first letter. So I don't really understand how the logic is flawed. Maybe there is a better way to search for a duplicate booking in a particular room on particular days.