12 Replies Latest reply on Jun 9, 2016 11:42 PM by user19752

    With Script Step FindReplace: how to find a length string

    listen2earth

      Dear Busy Filemaker Professionals

       

      hope you GOT TIME to pass by here!

       

       

      Cannot work out how  to use Script Step FindReplace to Find.. ANY DIGIT number strings that are length 12 in a alphanumeric large global text field. Seems i never can grasp the simplistic expressions when overwhelmed writing lengthy complicated scripts.

       

      expressions probably uses:

      filter

      get middle words

      length()

       

      situation?

       

      Bunch of old bank statements. Pasted into global.

      Editing. Into value list.  Then will loop into records.

       

      HOWEVER THERES A BUNCH OF UNNECESSARY DIFFERENT LENGTHY DIGIT NUMBERS THAT NEED TO BE FOUND DELETED!!

       

      Thats for dropping by!!

       

      "ONCE A SOLIDER ALWAYS A SOLIDER"

      FROM&FOR "HeartLand America"

      Great Lakes Area

       

      United States American War Vet

      RJ

        • 1. Re: With Script Step FindReplace: how to find a length string
          listen2earth

          Hope i am using this forum correct.

           

          heres expression have using script step Find/Replace (Find/Next):

           

          Set variable $Counter =0

          Loop

           

          Perform Find/Replace

          if (

          Length ( MiddleWords ( Field2Search ; $Counter ; 1)) > 10 ; MiddleWords ( Field2Search ; $Counter  ; 1) ; "")

           

          pause

          end Loop

           

          performs find ok increases and highlites only those strings (words) that are >10 BUT WHEN IT IS < =10  IT SHOWS NOTHING NO HIGHLIGHT WHILE CLICKING CONTINUING PAUSE UNTIL IT LOCATES string >10 then it highlights.

           

          Filemaker 12 advance

          • 2. Re: With Script Step FindReplace: how to find a length string
            listen2earth

            Ok.... i getting my script to work!!

             

            It finds selected strings (words) that are of a chosen length:

             

            if (

            length ( GetWord( SearchField ; $counter) ) > 10 ;

            GetWord( SearchField ; $counter) ; "")

             

            BUT HOW DO _i_ hook up Filter(textToFilter) to this so _i_ get only numbers?????

             

            THIS "IS" WHERE _i_ am STUMPED!!

            thank you

            • 3. Re: With Script Step FindReplace: how to find a length string
              dtcgnet

              Paste a good sized selection of the actual data. It would be good to see an example of what sort of data you're encountering, and what sort of data you'd like once everything is done. It will help people understand exactly what you're trying to accomplish.

              • 4. Re: With Script Step FindReplace: how to find a length string
                BruceRobertson

                FileMaker Pro 15 Help

                 

                Filter(“(408)555-1212”;“0123456789”) returns 4085551212.

                • 5. Re: With Script Step FindReplace: how to find a length string
                  listen2earth

                  numbers??

                  Simply their various lengths

                  2345875336789

                  24456837578

                  bank reference number.

                   

                  all mixed in with other alphanumeric text.

                   

                  heres update summary of my situatio:

                   

                  how can one use FindReplace in a lengthy global alphanumeric text field for locating digit / number strings greater than length 10.

                   

                  And in my loop when returning results desire to display the patternCount of what was found and then along with option to Replace 1 or Replace All.

                   

                   

                   

                  Thank You Much For

                   

                  Your Time Energy

                  iAppreciate Your..

                   

                  ..Productive Healing Earth Endeavors"

                   

                   

                  "Once A Soldier Always A Soldier"
                  United States American War Veteran

                   

                  From&For "America's Heart Land Peace"

                   

                   

                  Jesus Mourning Sun

                   

                  alias Robert Lewis

                   

                  •~•~•~from~•~•~•

                   

                                        •

                  |||()||| |||()|||_business name_|||()||| |||()||| ||()||

                  |||||~STRUCTURES~from~SILENCE~||||

                  Earths~Dynamic~Airwave~Changing~All

                  •<><><>~<><><>•<><><>~<><><>•

                  • 6. Re: With Script Step FindReplace: how to find a length string
                    dtcgnet

                    Try:

                     

                    Length ( Filter ( YourTable::YourField ) ; "0123456789" )

                     

                    That will give you a number equal to how many numbers you had in your field.

                    • 7. Re: With Script Step FindReplace: how to find a length string
                      BruceRobertson

                      You've been given the answer twice now.

                      Once at 6:47AM and once at 8:24AM.

                      • 8. Re: With Script Step FindReplace: how to find a length string
                        listen2earth

                        Here's sample of 1 value line

                         

                        03/28/2008 Refund card 08/27 walmart #1388 Super Center 800-312-3344 3546896542323 $50.00 $2,545.88

                         

                        bunch of reference numbers.

                        want to find them. delete them. While maintaining all other data. in the values. Values separated by carriage returns. All in a global text field.

                         

                        Just trying to clean up unwanted text. Then will enter my values into records, later.

                        • 9. Re: With Script Step FindReplace: how to find a length string
                          jfletch

                          Try this:

                          1. Loop through the text pulling out each line like you showed here (Use GetValue).

                          2. Convert the spaces to carriage returns ("¶") with Substitute.

                          3. Loop through each line of your new list testing for the presence of your number pattern.

                          4. Note the value number of the line that has the offending number (n).

                          5. Create a variable with the values 1 to n-1 and n+1 to ValueCount ( original line converted to list )

                          6. Substitute spaces back in for carriage returns

                          7. Build a new Variable by adding each modified line to it

                          8. When done building your new list, set it back to the original field replacing the original contents.

                          • 10. Re: With Script Step FindReplace: how to find a length string
                            listen2earth

                            Right!!! Correct!!

                            thats much some, what i got going!!

                             

                            still a bit unsure about how to write expression to find a certain length number digit string (word)???

                             

                            Length ( filter ( getWords( field ; $Counter)  ; "0123456789")

                             

                            i believe that's it above!! As was earlier pointed out!!!

                            not in front of my machine right now but do believe the above express will work In the loop.

                             

                            BOTTOM LINE:

                            It appears that my string detection using a input field for choosing length AND another input field for filtering can evolve, to do the same thing and much more than the ol PatternCount function because when detecting strings employing Length and Filters allows you to have more elegant calculations/ specific Finds.

                            • 11. Re: With Script Step FindReplace: how to find a length string
                              jfletch

                              Yes you don't need pattern count, but you do need to look at only one value at a time, which is why I suggested converting your line to a list and evaluating one word at a time with GetValue. The same thing could be done by using MiddleWords and looping through each word. It's just that middle words can find other things than spaces to define the boundaries of a word with, so I tend to shy away from it. Converting spaces to carriage returns and using the "Value" functions seems more reliable to me.

                               

                              Your length test won't work as written however, because GetWords is not a function. You would use MiddleWords with this approach:

                               

                              Length ( Filter ( MiddleWords ( $text ; $counter ; 1 ; 1 ) ; "0123456789" ) ) > 11

                               

                               

                              The calc for the list approach would be:

                               

                              Length ( Filter ( GetValue ( $text ; $counter ) ; "0123456789" ) ) > 11

                              • 12. Re: With Script Step FindReplace: how to find a length string
                                user19752

                                There need checking "Filter() ed value = original text" before checking length, to avoid

                                1a234567890123

                                will pass.