2 Replies Latest reply on Apr 24, 2014 11:46 AM by AlishaDenicola

    Quick Find Script

    AlishaDenicola

      Title

      Quick Find Script

      Post

           Hello, 

           I'm trying to create a field and button combo that will allow users to search the database. I am using an existing find script, but it continues to pull up a dialogue box with no dialogue in it, and it does not actually find the records searched for. 

           The script is huge, and I'm hoping there is a simpler way to perform a find. I need the search parameters to allow a user to search for any word in any field. 

           Current Script: 

           Commit Records/Requests [No dialog]
           If [ /IsEmpty (Contacts::varUberFind)*/]
               Show Custom Dialog ["Quick Find"; "Please Enter your find Criteria then press \ "Quick Find\""]
               Exit Script []
           Else
               Set Variable [$$quickfind; Value:"/*\"*\" & Contacts::varUberFind & \"*\"*/"]
               Set Error Capture [On]
               Enter Find Mode []
               Set Field [Contacts::Name; $$quickfind]
               New Record/Request
               Set Field [Contacts::Company; $$quickfind]
               New Record/Request
               Set Field [Contacts::Last; $$quickfind]
               New Record/Request
               Set Field [Contacts::First; $$quickfind]
               Perform Find []
               If [Get ( FoundCount ) = 0]
                  Show Custom Dialog ["Quick Find"; /*"¶" & "No Contacts or Companies match " & Quote (Contact::varUberFind) & \"\¶\¶\" & \"Showing All Records\"*/"
                  Show All Records
                  Set Field [Contacts::varUberFind; ""]
                Else
                  Set Field [Contacts::varUberFind; ""]
                End If 
           End If

           I'm not entirely sure why the original creator went with this script, but any way of simplifying this and actually making it work would be very much appreciated. 

           Thanks, 
           Alisha

            

        • 1. Re: Quick Find Script
          philmodjunk

               First, it isn't actually a "quick find". It's a standard FileMaker Find. The "quick find" that scripts the same type of action you get by entering text into the quickfind box in the status toolbar uses a very different and much shorter script.

               It would appear that you either copy/pasted or imported this script from another file and that when you did so, several calculations were enclosed in /* comment brackets */ and thus those script steps do not have any calculation in them until you remove the /* and */ characters. This happens when the calculation refers to items that do not exist in the new file.

               This is both why your script doesn't find records and why the custom dialog box is empty. (The calculation for it is enclosed in comment brackets.)

               But if you want to set up a quick find script, you could do the following:

               Perform QuickFind [Contacts::UberFind ]

                

          • 2. Re: Quick Find Script
            AlishaDenicola

                 The script you put up works like a charm. 

                 Yeah I'm modifying someone else's database, and I think they probably did copy paste quite a bit of it, as this is not the first script to have that problem. My filemaker experience is fairly limited, and scripts and calculations are not my forte. 

                 Thanks!!!