6 Replies Latest reply on Sep 29, 2009 6:55 PM by builder

    Search Script Problems

    builder

      Title

      Search Script Problems

      Post

      Hello All, 

           I have a music student database I made (Filemaker Adv 10 + OSX 10.5.8) that tracks attendance in sectionals and rehearsals.

      In my sectional table, I have script that runs to make sure that you don't created duplicate by searching my date and sectional name. I was working fine, until today. I have a sectional called "Low Brass A" and one called "Low Brass B". When the script runs and searches for "Low Brass B", it returns "Low Brass A" as a match in the find, but it won't do the same with sectionals called "Trumpet A" and "Trumpet B". Does that make sense. What am I missing....

       

      Thanks

      Craig 

        • 1. Re: Search Script Problems
          philmodjunk
             Please post a copy of the script. If you don't want to type it, print it to PDF and copy the text or, if you have fmp advanced, copy the script from the DDR.
          • 2. Re: Search Script Problems
            builder
              
            • Freeze Window
            • Allow User Abort [ Off ]
            • Set Error Capture [ On ]
            • If [ IsEmpty ( Sectional::date ) ]
            • Exit Script [ ]
            • End If
            • Set Variable [ $checkDate; Value:Sectional::date ]
            • Set Variable [ $checkEns; Value:Sectional::groupfk ]
            • Go to Layout [ “Sectional Attendance” (Sectional Attendance) ]
            • Enter Find Mode [ ]
            • Set Field [ Sectional Attendance::date; $checkDate ]
            • Set Field [ Sectional Attendance::group_fk; $checkEns ]
            • Perform Find [ ]
            • If [ Get (FoundCount) = 0 ]
            • Show All Records
            • Go to Layout [ “Sectional” (Sectional) ]
            • Exit Script [ ]
            • Else
            • Show All Records
            • Go to Layout [ “Sectional” (Sectional) ]
            • Show Custom Dialog [ Title: "Duplicate Sectional"; Message: "Sectional already exists."; Buttons: “OK” ]
            • Set Field [ Sectional::date; "" ]
            • Set Field [ Sectional::groupfk; "" ]
            • End If
            • 3. Re: Search Script Problems
              philmodjunk
                

              Have you tried running this script with the debugger and data-viewer enabled?

               

              Since your script does a "show all records" if any records are found, it might be difficult to determine exactly what found set of records were returned when the find was performed in the script.

              • 4. Re: Search Script Problems
                builder
                  

                It is strange, the debugger shows that the two do not match.....even if I don't use a script and just perform an manual find for "Low Brass B" the found count come up as 2 and lists records with "Low Brass A" as the matches... Is this just how it works?

                 

                • 5. Re: Search Script Problems
                  comment_1
                    

                  builder wrote:
                  When the script runs and searches for "Low Brass B", it returns "Low Brass A" as a match in the find

                  The default Filemaker search is for "words that start with …". Therefore, when you search for "Low Brass B" the found set also includes "Low Brass A" because:

                   

                  1. It contains a word that starts with "Low" ("Low");

                  AND

                  2. It contains a word that starts with "Brass" ("Brass");

                  AND

                  3. It contains a word that starts with "B" ("Brass")

                   

                   

                  See the help file on how to perform a more refined search (e.g. "Low Brass =B").

                  • 6. Re: Search Script Problems
                    builder
                       Thanks..... "==" &$variable solved it