5 Replies Latest reply on Oct 28, 2013 10:33 AM by philmodjunk

    Quick Find script

    ScottYoung

      Title

      Quick Find script

      Post

           I know this might have already been answered, and it seems easy but I haven't been able to either create it or find it from searching.  I just want a script that will take what is in the clipboard and do a simple Quick Find of all fields in the table (i'm not concerned about the quirks of Quick Find). Thank you very much for your help.

        • 1. Re: Quick Find script
          philmodjunk

               Add a global field to your layout. You can hide it, even put it to the right of the right hand layout boundary, but it must be present on the layout and Behavior settings must permit browse mode access.

               Then your script can function like this:

               Paste [ Select; Table::GlobalField ]
               Quick Find [ Table::GlobalField ]

          • 2. Re: Quick Find script
            ScottYoung

                 Great. Thank you very much - I don't understand the rationale, but it works!

            • 3. Re: Quick Find script
              philmodjunk

                   The only way to access data in the clipboard is to paste the data into a field as then you can access the data in the field. (of course you could just paste directly into the quick find field manually and not use any script.)

                   Paste, like the Copy and the script steps that start with the word "Insert" only work if the specified field is present on the current layout and accessible for editing. In earlier versions, we sometimes had to size such a field very small and hide it behind other layout objects, but in FileMaker 12, we now can place the field to the right of the layout border.

                   But if you are using the copy script step to copy this data from a field in your database, you are not using the best method for moving data from one field to another. Since copy copies data to the clipboard, this copied data will replace anything that the user may have previously copied. When they later try to paste from the clipboard and get the data copied by your script instead of what they had copied, the result is an irritated and confused user--not a good thing at all!

                   Fortunately, there are several other ways to move data around that do not require copying data into the clipboard. The method used here would only be needed for using data copied from outside of FIleMaker for performing a quick find.

              • 4. Re: Quick Find script
                ScottYoung

                     Thank you very much for your careful explanation.

                     What I ended up doing: In script A, I first copied the data from a particular field in a particular record and then opened a different table. Then the QuickFind script was called by script A to show any records with that data. I hadn't been able to devise a different approach using relationships or other finds...

                • 5. Re: Quick Find script
                  philmodjunk

                       Instead of copy/paste do set variable, set field, or for your quick find, just set a field with global storage to the value.

                       Basic set variable/set field method for moving data from a field in one table to a field in another:

                       Set variable [$Variable ; value : YourTable1::Field ]
                       Go to layout ["Table2" (Table2) ]
                       Set field [Table2::Field ; $Variable ]

                       Modified method for your quick find:

                       Set Field [YourTable::gGlobalField ; YourTable::Field ]
                       Go to Layout
                       Perform QuickFind [YourTable::gGlobalField ]

                       A field with global storage specified can be defined in any table and it will be accessible on any layout or in any script in the file. To specify global storage, use field options from Manage | Database | Fields (Double click the field).