6 Replies Latest reply on Jan 27, 2011 12:32 PM by philmodjunk

    Repeating a find...

    paintboothguy

      Title

      Repeating a find...

      Post

      Good morning Forum, 

      I wonder is someone can help with a script?

      I would like to have the script navigate to the previously viewed layout, enter find mode and perform the last find again.

      I looked for a get(last find entry) or something to that effect and came up empty handed.

      Any ideas?

      Thanks!, 

      Andrew

      FM Pro 10.0v3, Mac OS 10.6.6

        • 1. Re: Repeating a find...
          Sorbsbuster

          Use the script step 'Modify Last Find.

          • 2. Re: Repeating a find...
            paintboothguy

            Sorbuster, 

            Here is the script I tried:

            Go To Layout ["Record Detail" (Contact Management)]

            Enter Find Mode []

            Modify Last Find []

            Perform Find []

            When i run the script FM tells me that "There are no valid criteria in this request.Type a valid request before clicking Find."  

            I need the script to automatically enter the 'criteria' that was entered before, thus repeating the last find with the push of a button.

            Thanks!, 

            Andrew

            FM Pro 10.0v3, Mac OS 10.6.6

            • 3. Re: Repeating a find...
              Sorbsbuster

              It works perfectly for me, so I suspect that you are doing something bewteen actually doing the last find, and running the script, so that the notion of the 'Last Find' has become lost.

              Here is what I did:

              Set a script with three steps

              Modify Last Find

              Pause / Resume Script (just so I can see how the Find Requests look, for de-bugging)

              Perform Find []

              I perform a find.  I click the script, and it shows me the find request again exactly as I had entered it previously.  I press 'Enter' to continue the script and it correctly re-finds the records.

              • 4. Re: Repeating a find...
                Sorbsbuster

                Ah!!! - Don't 'Enter Find Mode'!!

                • 5. Re: Repeating a find...
                  paintboothguy

                  Sorbuster,

                  I omitted the step "Enter Find Mode" and got the same result.

                  Maybe I should clarify my exact procedure and what I need the script to do:

                  step#1:

                  I search the contacts for, lets say, "Andrew" and I get a found set. (we'll call this find #1.)

                  step#2:

                  I run a script that sets a variable (customers ID#) and goest to a new layout, where the script plugs that variable into the lew layout, performs a find and brings up the client related document.  (we'll call this find #2.)

                  What I need the new script to do is go back the the original layout, and perform 'find #1.'

                  Thanks!, 

                  Andrew

                  FM Pro 10.0v3, Mac OS 10.6.6

                  • 6. Re: Repeating a find...
                    philmodjunk

                    Modify find only modifies the most recent find. Since the script performs a find, that find becomes the one accessed by modify find.

                    To do what you describe, you'd have to store the criteria for find #1 in global fields, global variables or possibly a related table so that you can recreate the find (and modify it) later.

                    This is easy to do if the original find is run from criteria entered by the user into global variables. If not, then it's not so easy.