7 Replies Latest reply on Jan 21, 2016 8:37 AM by estar

    How do I make this find work.

    dgp_express

      I have a script that is giving one letter from the alphabet as its parameter to perform a find request.

       

      It works well but it includes in its found set every record where that letter is the the first letter of any word in the field.

       

      How do I limit it to only include in the found set those records where only the first word starts with that letter.

       

      If I have 2 records:

       

      Don Alger

      Ron Davidson

       

      I want it to find only the first record and not both if it is sent the parameter of the letter D.

        • 1. Re: How do I make this find work.
          nicolai

          Use D* as your search parameter

          • 2. Re: How do I make this find work.
            dgp_express

            Thank you for your response.

             

            The parameter that needs to pass to make that work is ==D*

            • 3. Re: How do I make this find work.
              nicolai

              Works fine for me without "==". Does not make sense to include match the whole field operator with a wild card. You obviously testing it on your data set and you requirements are probably wider than your sample. In any case, I am glad your fond your answer

               

              Nicolai

              • 4. Re: How do I make this find work.
                beverly

                The FileMaker finds by default using "begins with" and for any word in a field. When doing multiple words (an AND find in a single field) the order of the words need not even matter!

                 

                Find ("J B") would find both "James Butler" & "Butler, James", for example.

                 

                Using a single character followed by the asterisk wildcard would be the same as "begins with" (anywhere in the field) followed by ZERO OR MORE CHARACTERS.

                 

                The ==<<singlecharacter>>* does work with the START of the field.

                 

                In any find the case of the character doesn't matter, but accented characters do. Lot's of things to learn about Finds in FileMaker!

                beverly

                • 5. Re: How do I make this find work.
                  Extensitech

                  nicolai wrote:

                   

                  Does not make sense to include match the whole field operator with a wild card.

                   

                  Nicolai

                  I disagree.

                   

                  Given three records with "J", "John" and "John Smith"

                  • J* and =J* will both find all three records
                  • ==J* will find J and John, but NOT John Smith
                  • ==J will find only J

                   

                  Twice in one day: FWIW: FileMaker Power Finds | Extensitech

                   

                  Chris Cain

                  Extensitech

                  • 6. Re: How do I make this find work.
                    nicolai

                    You are absolutely right, Chris - I stand corrected. It does matter and it matches the OP better.

                    • 7. Re: How do I make this find work.
                      estar

                      Create a global field (text) called First_of_search

                       

                      Create the field (text) you want to do the find in: Call it Last_name

                       

                      Create a calc field named First_of_Last = Left ( LastName ; 1 )

                       

                      Create a calc field named they_are_equal = [ First_of_last=First_of_search ]

                       

                      In the layout, where u want to do the Find, put the First_of_search field somwhere in the body part - and of course also the field Last_name.

                      --

                      Create a script called find_equal

                      ........

                      enter browse mode

                      Perform Find [Restore] ---- Find Records filename: they_are_equal [=1]

                      Sort Records [Restore; no dialog] (alpha or whatever)

                      View As [View As List]

                      Go to Record/Request/Page [First]

                      ......

                      --

                      In Layout Mode select the field First_of_search

                      In the layout menu select Set Tab Order

                      Clear All

                      Select field First_of_search

                      Click OK

                      --

                      Set Script Trigger

                      Event Script

                       

                      √ OnObjectModify "Find_equal"

                      --

                      From then on all you have to do upon entering this layout in Browse Mode is:

                      Press TAB then enter the letter you want to search / find with.

                       

                      e.g. Taba or A  gives:

                       

                      Anderson Theodore

                      Albertsson Fidel

                      Alger Don

                      Allthatcounts etc, etc

                      ---

                      brgds

                      estar