12 Replies Latest reply on Nov 8, 2015 8:55 PM by juandent

    Find isn't finding!

    juandent

      Hi,

       

      ProblemScript.png

      My finding isn't working all time! It seems so simple, yet I can't find records that I know exist in the T06_Conceptos table.

       

       

      What could be happening?

       

       

      Thanks!!

      Juan

        • 1. Re: Find isn't finding!
          BruceRobertson

          Your script is very seriously flawed.

          I would not say your script is simple.

          I would say your script is pretty much incomprehensible.

          You never declare variables $F1, $F2, $F3; so they are empty.

          First you go to a layout.

          You create a new record.

          You set fields to values you have not declared.

          You have an if statement evaluate an error; but the if statement doesn't do anything.

           

          You should sign up for some FileMaker training, or find some way to learn a LOT more about FileMaker scripting.

          • 2. Re: Find isn't finding!
            juandent

            hi

             

            YEs I understand why you think so badly of my script: I only sent s piece of it with the idea to make it simpler

             

            will send complete shortly

            thanks

            • 3. Re: Find isn't finding!
              juandent

              Hi,

               

              The complete script is:

              Script-1.png

               

              Script-2.png

               

              Script-3.png

              // -------------

               

              So, I think this is very clear now. At least a bit better.

               

              Appreciate any ideas...

               

              As I say, the only Find does not always find the record even if it exists... the search is donde over the nombreConcepto field of the T06_Conceptos table occurrence (an anchor)..

               

               

              Thanks!!

              Juan

              • 4. Re: Find isn't finding!
                coherentkris

                Step thru the script with the debugger.

                What does $F2 contain right before the Enter Find Mode script step?

                Performa manual fiind on layout L60_Conceptos and see what you get.

                • 5. Re: Find isn't finding!
                  BruceRobertson

                  Remind us - you have FileMaker Pro Advanced and you know how to use the script debugger?

                  • 6. Re: Find isn't finding!
                    juandent

                    Hi Bruce,

                     

                    Yes I have FM Pro Adv...

                     

                    The script should be clear if I explain:

                     

                    the outer loop creates statement lines, and each time we set the LINE_CONCEPT we look for a Concept to match (from T06_Conceptos)... this is the only Find in the script. The problem is that sometimes the Find does not find the Concept record even though it has been created in a previous iteration of the loop. This creates duplicate record in the T06_Conceptos table which is wrong.

                     

                    Can you see?

                     

                    Thanks for all your help,

                     

                    Juan

                    • 7. Re: Find isn't finding!
                      fclark

                      the set variable $f2 trimall script step could be removing a space changing the value ie there is a first and last name in that Value.

                      • 8. Re: Find isn't finding!
                        coherentkris

                        If he ran the script with the debugger and answered my question he would also answer yours...

                        • 9. Re: Find isn't finding!
                          juandent

                          Hi,

                           

                          What I find in $F2 before the Find, is

                           

                          VICTORIA'S SECRET CATA\08008881500

                           

                           

                          which exists in the table of T06_Conceptos but cannot be found, not even in a MANUAL Find....

                           

                          so I think it has something to do the "\" character right?

                           

                          Seems to me the text is stored diferently?

                           

                          May be the solution to my question!

                           

                          Juan

                          • 10. Re: Find isn't finding!
                            SteveMartino

                            Just a thought, you're using TrimAll on the $F2 variable for the find.  Does the actual field that has the data have any extra space/returns in them?

                            • 11. Re: Find isn't finding!
                              juandent

                              FIXED IT!!

                               

                              THANKS!!

                               

                               

                              JUAN

                              • 12. Re: Find isn't finding!
                                juandent

                                So, to thank you all, I thought I shared what was going on with the Find.

                                 

                                Not for every concept, just a few, the Find couldn't find concepts that existed in the Concepts table. Why?

                                 

                                Well, the value I placed in the concept field in order to search had special search operators (like  \) and thus would not find the match. So all that was needed is for each possible operator used in a Find (=,==, etc), escape them using Substitute and search with this modified fields. It works!

                                 

                                Thanks to all of you!!

                                 

                                Juan Dent