10 Replies Latest reply on Jun 9, 2011 3:26 PM by philmodjunk

    Find Mode not validating Data Type…

    andrewggrant

      Summary

      Find Mode not validating Data Type…

      Product

      FileMaker Pro

      Version

      FMPA 11 v3

      Operating system version

      OS X 10.6.7

      Description of the issue

      When manually searching a number field with "5tc" a validation error appears.

      The same search in a script step fails to result in an error code in the debugger window.

      Field: "Quantity Onhand"
      Settings: Indexed, Auto-enter: “0”, Always validate, Required value, Only allow values of type: “Numeric Only”

      Script Steps:
      Enter Find Mode [ ]
      Set Field [ Spares::Quantity Onhand; "5tc" ]
      Perform Find [ ]

      The result is that all records with the value of "5" in the field are found with the script.

      I am trying to trap errors with a much more complicated search, but wish to see when a validation error occurs in the search steps. Can this be done? Is this a bug?

      Steps to reproduce the problem

      Field: "Quantity Onhand"
      Settings: Indexed, Auto-enter: “0”, Always validate, Required value, Only allow values of type: “Numeric Only”

      Script Steps:
      Enter Find Mode [ ]
      Set Field [ Spares::Quantity Onhand; "5tc" ]
      Perform Find [ ]

      No error when script is run.

      Expected result

      Expected a validation error in the debugger window.

      Actual result

      Debugger error code of "0" during all steps. Actual records found containing only part of my search.

      Exact text of any error message(s) that appear

      None.

      Workaround

      Looking for a way to trap errors in validation that occur when manually performing same steps as the script performs.

        • 1. Re: Find Mode not validating Data Type…
          davidhead

          Hi Andrew

          I understand that you are "trying to trap errors with a much more complicated search" but I am struggling with your example.

          When I enter the calculation for the Set Field, I need to enter "5tc" but the dialog does say "Calculation result must be number". So I have been warned. When I run the script and then "Modify Last Find" using Command-R, I can see that FileMaker Pro has searched for 5tc in the field. So I can see your point - a script can set a field in a find request that is not validated as would be a manual entry. But the search only used the numeric portion of the entry which is expected.

          If I do it another way, when I try to store a find in a script that is invalid (searching 5tc in a number field with strict numeric validation), I get an error at that point - the script step cannot be stored. I can get around it is I turn off the validation, then create the script with the invalid stored find, and then turn on the validation again.

          My problem lies with why you would want to Set Field in a script with obviously bad data? Again, I understand that this is not your actual find request but I can't see what you are actually trying to do. Please help me to understand your real world issue.

          TS_Oz, FileMaker Inc.

          • 2. Re: Find Mode not validating Data Type…
            andrewggrant

            The real world issue is creating a global find that searches every field in every table in my DB using Loops and variables.

            I first compile a ValueList of all the names of all the fields and tables. I then loop through each field and table using the variables to name the fields and the Global field to enter the search string into each field.

            I need to be able to see when the search string is not valid for a fields required data type so I can skip requesting a new record for the next search field as every field is searched as an OR search rather than an AND search.

            I know I can do a quick search in FMP 11 but I am having to deal with older FMP10 clients and so this is the work around.

            What I really need to find is a way to get the errors that occur with a manual search to appear with the scripted search steps. Once the errors occur in the script, I can trap and respond to them accordingly. 

            • 3. Re: Find Mode not validating Data Type…
              philmodjunk

              One possible work around might be to define a calculation field that returns text that uses the & operator to combine all the fields from a given record that you want to search into a massive block of text, then search this field instead of the individual fields. It's not the ideal solution, but it would appear to work in this situation.

              • 4. Re: Find Mode not validating Data Type…
                andrewggrant

                Hmm. That is an interesting option... though the real purpose here is to search every field in every table of the DB using the search string.

                That is why I am using the Find script step.

                Any idea if the lack of an error generated is a bug?

                • 5. Re: Find Mode not validating Data Type…
                  philmodjunk

                  A "bug" designation needs to come from a FileMaker Tech person. I'm just a fellow user.

                  The method I described does enable you to search every field of every table in your database, though you'd need such a calculation field defined in every table and enter the search criteria into each such field in turn. It actually makes for a simpler script, though you pay for it in having to define and maintain this extra calculation field.

                  • 6. Re: Find Mode not validating Data Type…

                    Andrew G. Grant:

                    Thank you for your report.

                    I was able to reproduce this behavior as well so I've forwarded your post to our Development and Quality Assurance departments for review and confirmation. 

                    TSBear
                    FileMaker, Inc. 

                    • 7. Re: Find Mode not validating Data Type…

                      Andrew G. Grant:

                      Our Development department has communicated the following indicating that this behavior is by design:

                      "In find mode, set field will bypass validation to allow people to create find requests using find operators."

                      TSBear
                      FileMaker, Inc. 

                      • 8. Re: Find Mode not validating Data Type…
                        philmodjunk

                        Except when it's a numeric only validated field and you put an * in it. Wink

                        (Known Bug reported here: Validation active in find mode )

                        • 9. Re: Find Mode not validating Data Type…

                          PhilModJunk:

                          Sorry, I should clarify a bit more. This pertains only to the Set Field statement in find mode. So, using Set Field in a script while in Find Mode to place * in a field will result in all records being found. Placing * in that field manually and attempting to search for it will throw an error.

                          TSBear
                          FileMaker, Inc. 

                          • 10. Re: Find Mode not validating Data Type…
                            philmodjunk

                            Actually, I wasn't being too clear in my thinking. I was assuming identical behavior both ways here. Obviously, that's not the case.