8 Replies Latest reply on Mar 15, 2015 10:46 AM by tays01s

    Find with a '@' in it

    tays01s

      Title

      Find with a '@' in it

      Post

      I've little practice with 'Finds', but was  wanting to 'Find' an email address. Unfortunately if there's an '@' in the text it fails to find the record.

      Am I missing something?

        • 1. Re: Find with a '@' in it
          JonathanYoung

          Did you try putting the @ in "". So your find is "@" ?

           

          • 2. Re: Find with a '@' in it
            tays01s

            You're right, that works. However, I don't understand the reason why it didn't work in the first place since it's a text field?

            And if this is the case, I assume to 'automate' it I'll need to have a text in which to paste the email address and a calc field wraps it in " " and does the find.

            • 3. Re: Find with a '@' in it
              philmodjunk

              Enter find mode and then pull down the "operators" drop down. You'll see that several characters, including @, have a special function when used as find criteria. Enclosing it in quotes tells FileMaker: "I don't want to use this as a find operator. I just want to use it as another text character."

              • 4. Re: Find with a '@' in it
                tays01s

                Ah! I get it.

                If searching for a user record by their email is likely to be the most efficient discriminator, but obviously has the problem of the '@', what might be the most efficient way to paste their email into a 'Lookup email' field, then perform a find to see if there's a matching record by the 'email' field? The 'Perform Find' script step appears to use specific values rather than a value entered into deliberately into a field to then find by.

                • 5. Re: Find with a '@' in it
                  GuyStevens

                  Couldn't you create a text field field set to global storage and then put that on your layout as a search box.
                  Then you enter the email address you are looking for in that field. Next to it a Search button that runs a script that does a fiend but puts your entire email address between quotation marks for the find.

                  That script would be:

                  Enter Find More [Uncheck pause]
                  Set Field [Contact::email ; "\"" & g_EmailAddressFind & "\"" ]
                  Set Error Capture [On]
                  Perform Find

                  You just have to make sure your search field is set to global storage. Then I'm sure this might work.

                  Try this: https://www.dropbox.com/s/ri832jikvzb5u27/Test_File.fmp12?dl=0 

                  • 6. Re: Find with a '@' in it
                    tays01s

                    If I just put '@' in the search field, it finds all records containing an '@'. However, if I put a specific email address in the search, then the script fails to find that email.

                    BTW, remind me why you use "\"" either side? Yes I need to bracket the find field contents within "", but I have forgotten why it's necessary to use "\"

                    • 7. Re: Find with a '@' in it
                      GuyStevens

                      Filemaker added that \ automatically when I created that calculation.

                      Normally quotation marks are used to put text in a calculation. But in this case we actually want to add quotation marks to the email address we are going to find.

                      If you put a pause in the script right after the set field step you will see that this script does a find with the quotation marks added to the email address you are trying to find.

                      • 8. Re: Find with a '@' in it
                        tays01s

                        Got it. Oddly when I put """ before + after the value, the first was reduced to "\" whereas the 2nd was "\"".

                        Anyway, thanks.