7 Replies Latest reply on Apr 13, 2016 9:10 AM by Ben_B94

    Match phrase Variable

    Ben_B94

      Hi all,

       

      Can text searches be done on variables?If I have 1 variable = to a field , say $currItems, then I have another variable say $location can I do a text search to say, check to see if any part of the word or phrase stored in $currItems exists in the word or phrase stored in $location?

       

      Thanks

        • 1. Re: Match phrase Variable
          alecgregory

          For pattern matching in general use either Position or PatternCount.

           

          Position ( $location; $currItems; 1; 1 )

          Returns the position of the first occurrence of the full content of $currItems in $location

           

          PatternCount ( $location; $currItems )

          Returns the number of times that $currItems occurs in $location


          For value matching in return delimited lists use FilterValues


          FilterValues ( $location; $currItems )

          Returns a list of all values in $currItems that are also in $location


          But to your exact question "check to see if any part of the word or phrase stored in $currItems exists in the word or phrase stored in $location". The "part" might need more explanation. You might well need to break down the variable $currItems into these parts before running any of the pattern matching or value matching functions.

          • 2. Re: Match phrase Variable
            erolst

            Depending on your requirement, try either

             

            PatternCount ( $location ; $currItems )

             

            or

             

            not IsEmpty ( FilterValues ( $location ; $currItems ) )

             

            where the former matches on any substring(s), the latter on complete lines only (so PC would match "Susan" in "Susanne", but FV would not).

            • 3. Re: Match phrase Variable
              Ben_B94

              My problem is i'm trying to do the match on imported data, for example I have a location Summer Endowed School, but on the imported records, the location is down as just Summer School, so trying to match these 2 would never find each other? 

              • 4. Re: Match phrase Variable
                alecgregory

                A scripted FileMaker Find may be the way to go. That will match Summer Endowed School if you enter Summer School as the find criteria. When you have slightly mismatched data manual work is often required, unless you are willing to accept a certain level of inaccuracy, in which case there are various techniques you can employ.

                • 5. Re: Match phrase Variable
                  Ben_B94

                  the slight inaccuracy i'm ok with, locations are just a name, and the imported records location will be some close variation of that name unless there's some obscure nickname, which would rarely happen( or so i hope ).

                   

                  But how do you do a find but with variables when creating the find criteria?

                  • 6. Re: Match phrase Variable
                    alecgregory

                    But how do you do a find but with variables when creating the find criteria?

                    If you are generating all your scripted finds within the Perform Find [requests] script step, then you just put the variable itself into the criteria you create. FileMaker will expand that to the data in the variable when the script runs.

                     

                    If you are using the Enter Find Mode > Set Field > Perform Find[] approach in your script then use the variable as the calculation for the Set Field step.

                     

                    This assumes that your locations that you're checking the imported data against are stored in a FileMaker table. You'd have to find within that table.

                    • 7. Re: Match phrase Variable
                      Ben_B94

                      The longer I look at this the more confused I make myself.

                      Thanks for the help both, but I think this is more complicated than I first thought.

                       

                      Maybe have to make another thread to look at the script and the join table layout.

                       


                      Hire Join.jpg



                      Start of the script makes records and populates the bottom site name with all the locations. I want it to populate the top field with the corresponding location matched by the same name but I'm confusing myself about these drop downs. Do I need to set the ID drop down to show the right field?