3 Replies Latest reply on Nov 18, 2009 8:04 AM by FBS

    Using a script to perform finds

    FBS

      Title

      Using a script to perform finds

      Post

      I am using Filemaker Pro 5 with Windows XP. I have a database of names. I would like to have buttons with A, B, C, etc. and when a button is clicked the records whose last names begin with that letter are the only ones shown.

      Example: If "B" is clicked only the last names beginning with be will be shown.

      I would like to have the Buttons (letters) along the top of my layout.

       

      I hope someone can help.

       

      Thanks

       

      FBS

        • 1. Re: Using a script to perform finds
          davidanders
            

          Make sure you have an entry for each letter.

          Do a find for A

          Make a script for Find A

          Do a find for B

          Make a script for Find B

          This is tedious, work on a backup of your database, save AS often, test often

           

          • 2. Re: Using a script to perform finds
            philmodjunk
              

            In FMP 10, you could use one script for all the buttons and pass the letter as a parameter, choosing a different letter parameter for each button.

             

            In FMP 5, you don't have that option.

             

            You could make one script and simply duplicate it, giving each script a different script name. You could name them "Search A", "Search B", "Search C" .....

             

            Write your script like this:

             

            Enter Find Mode[]

            #I may not be remembering the exact name of this get function in FMP 5, but there is one that returns the name of the script

            Set Field [YourSearchField; RightWords( Get ( CurrentScriptName ) ; 1 ) & "*" ]

            Set Error capture [on]

            Perform Find []

            # do what you want to do with the found set here

             

            Once you have the script working for finding all records where name starts with A, simply duplicate this script and change its name so that the last word of the script name is the appropriate letter of the alphabet.

             

            Note: This script is formatted as best I can remember for FMP 5, FMP 7 and later releases would need to include a table occurrence name in the Set Field step.

            • 3. Re: Using a script to perform finds
              FBS
                

              Thanks for you help.

              I had tried this and was doing something wrong. Following your steps, carefully, I was able to make it work.

               

              Thanks again!