14 Replies Latest reply on Aug 4, 2013 2:46 PM by philmodjunk

    Find Script



      Find Script


           Tryi to find out if there is a  script to find numbers that are arranged in a different order but have the same numbers:

           Find  12345. I will find all duplicates of this number exactly. But I want to find if the numbers  if  arranged (54321 or  24351) and so on.

           Using Filmaker PRO12 .

        • 1. Re: Find Script

               You might explore the PatternCount() function.

               Separate your number into 1 & 2 & 3 & 4 & 5

               Do a patterncount find for 1

               then constrain the set for those with 2

               then 3

               then 4...

               I'm sure there are other ways.

               FWIW, this might be easier if the field were a text field I think.

          • 2. Re: Find Script

                 Thanks I will try that.

            • 3. Re: Find Script

                   Perhaps the digits of this number shold be parsed into separate fields.

              • 4. Re: Find Script


                                  I think I understand what you are saying......  Each digit should  be separted vice together?

                • 5. Re: Find Script

                       scratch that idea--caffiene hadn't kicked in. On further thought that won't resolve the issue that the digits can appear in any order.

                  • 6. Re: Find Script

                         I understand. Same here. I thought it would be easy.

                    • 7. Re: Find Script

                           Yeah, I thought of that...that's why I opted for a patterncount (does this digit exist here?) with a sequential list of constraining finds ("does this one exist too?")

                           I think it might actually have to go through a loop...or have another field tagged for "I'm still in the found set".  Finding using patterncount doesn't work directly...but using external flags might get it done.

                      • 8. Re: Find Script

                             I am goign to give it a try.

                        • 9. Re: Find Script

                               Guess it would be easier with FileMaker Pro Advance.

                          • 10. Re: Find Script

                                 Not really any different with Advanced.

                                 My thought process:

                                 Create a global field "gDigit"

                                 Create a global field "gNumber"

                                 Create a calc field "cPatterncount" defined as If(Patterncount (NumberField) ; gDigit) > 1 ; 1 ; 0) {unstored}

                                 In your script, trap the first digit and set it to gdigit...then find for 1 in the calc field.

                                 Then trap the second digit and set it into gDigit...then find for 1 in the calc field (constrain found set)

                                 then the third, then the fourth.

                                 ...needs some polish, but thats the general thought process...

                                 one piece of immediate polish is how to handle if the number string you are looking for has repeats:  11256

                                 The approach above would also find 12256.  Need to handle that somehow...like comparing patterncount (gNumber ; gDigit) with patterncount (NumberFiled; gdigit) or something like that.

                            • 11. Re: Find Script

                                   You could do this without the pattern count calculation.

                                   Use criteria enclosed in the * wildcard operator and use your one digit at a time search method.

                                   Search for *5*, then search for *4* and constrain.....

                                   Hmmm and if there were word separators between the digits? let me check that idea....

                                   Yes! I thought that would work. If you enter your data or use a calculation field to parse the data into this format:

                                   1 2 3 4 5

                                   You can enter your criteria separated by spaces also: 5 4 3 2 1

                                   and it will find all records with those digits regardless of the order.

                              • 12. Re: Find Script

                                     I am on the road I will use it ASAP and let u know  thanks

                                • 13. Re: Find Script
                                              You got me in the right direction with the  last solution. Although I really feel stumped right now. Should this be done using a scrpit? or can this be done using the simple find? I tried using this in find but it does not work.
                                  • 14. Re: Find Script

                                         Scripted finds and manual finds process the criteria to perform the find Identically. I tested this with a manual find before posting that last message. It does indeed work, but the field needs to be of type text as this is a text based method. So a calculation field set to return text may be needed to facilitate this process.