4 Replies Latest reply on Nov 11, 2014 6:56 PM by coherentkris

    Find documentation error

    coherentkris

      Noticed that in the FTS 13 pg 419 it states;

      "If a script needs to use field data or some other dynamic and/or derived value as search criteria, then you

      cannot use the Perform Find script step in the manner demonstrated in Activity 30.1. The criteria stored

      within the Perform Find script step can only be literal values. For dynamic criteria, you must use a multistep

      script routine that involves entering Find mode, setting the content of one or more search fields, and

      then performing the search."

       

      This is not necessarily true unless i am misundetrstanding the section completely.

       

      For instance if you have a names table with a field called first_name and you can script the following and it will execute appropriatley

      ...

      SetVariable $a = "the first name"

      Perform Find with imbedded find critetria of names::first_name=$a

      ...

       

      Kris

        • 1. Re: Find documentation error
          planteg

          NOTE: for those who would like to look at this documentation, Kris is talking about the advanced course for FMP 13

          ______________________________

           

          Kris,

           

          this does not seem an error. What they state is that the criteria has to be a literal value. that means that the criteria can be specifically a literal value such as "the first name" or a variable that contains a literal. The criteria could not point for example to another field where it's needed to read that field.

           

          I don't see anything in the Help file that's so precise.

           

          Exercise 30.2 explains how to do Dynamic Finds.

           

          If I am wrong, I hope an expert will tell.

          • 2. Re: Find documentation error
            coherentkris

            Yea I was re reading the text after my post and I got too hung up on when they said the imbedded find count not be "dynamic".

             

            Sent from my iPhone

            • 3. Re: Find documentation error
              ErikWegweiser

              ...and a reminder that when storing a value in a global field for use as search criteria, you (probably) need to test first whether that value is null.

              If you set $middle_name to the value in an empty Middle Name field, for instance, your search script will use "$middle_name" as the criteria, rather than "Betty."

              To get around this, I test and substitute a space for null value.

              • 4. Re: Find documentation error
                coherentkris

                I just did some testing and validated that when $a is an empty string or is not instantiated at all that the query becomes first_name="$a".

                Interesting behavior.

                FM throws 401 error when "$a" is not found in names::first_name.

                it does NOT detect that their is a 400 error just does the text substitute.