5 Replies Latest reply on Oct 30, 2008 2:27 PM by hopkins

    Scripted Finds

    hopkins

      Title

      Scripted Finds

      Post

      I wanted to set a single line in a sub-script to do a specific find dependant on the original calling script, but found that "Perform Find" with a function in the find specification does not work.  I cannot see why it should not.  Any suggestions?

       

      The actual line of the script I wanted to use read (the SciptParameter is the match ID that links the item of current concern with its classification in a classifications table and the search is for a "file" of the same classification):

      Perform Find [ Specified Find Requests: Criteria: Files::Classification Match: "=GetAsNumber ( Get ( ScriptParameter ) )" AND File::File Status: "="Open""].

       

      The only error message I got when setting up this was a reminder that the first part of the find request needed a number; but the function does return a number so that did not make sense. 

      In its place, to make this search work, I had to use four lines of script:

      Enter Find Mode []

      Set Field [Files::Classification Match; GetAsNumber ( Get ( ScriptParameter ) )]

      Set Field [Files::File Status; "Open"]

      Perform Find [] 

       

      Thank you. 

        • 1. Re: Scripted Finds
          davidhead
            

          Hi Ted

          You are correct in what you have seen and the solution to your problem. Unfortunately, the Find requests do not get evaluated so any criteria entered will be used literally. In your case, "GetAsNumber ( Get ( ScriptParameter ) )" will be used as the request.

           

          The only trite thing I can suggest is that your subscript could operate in three lines ;) :

           

          Enter Find Mode [Restored Find Request: Criteria: File::File Status: "="Open""]

          Set Field [Files::Classification Match; GetAsNumber ( Get ( ScriptParameter ) )]

          Perform Find [] 

           

          However, running this as a subscript is an efficient and effective way of programming so you are on the right track there. 

          • 2. Re: Scripted Finds
            hopkins
              

            Thank you David,

             

            Perhaps in a future upgrade FileMaker could permit find requests to evaluate a function.  I should think it would simplify a lot of scripted finds.

             

            Ted. 

            • 3. Re: Scripted Finds
              swc
                

              Ted wrote:

              Thank you David,

               

              Perhaps in a future upgrade FileMaker could permit find requests to evaluate a function.  I should think it would simplify a lot of scripted finds.

               

              Ted. 


              I second this.

               


              • 4. Re: Scripted Finds
                davidhead
                  

                To quote the moderators:  ;)

                 

                I think this is an excellent feature request, and I'd like for you to enter this information into the following Product Suggestion area:

                 

                http://www.filemaker.com/company/feature_request.html

                 

                I would do this for you, but the form asks questions that only you can answer. 

                • 5. Re: Scripted Finds
                  hopkins
                    

                  Thank you David,

                   

                  I have submitted it as a feature request.

                   

                  Ted.