7 Replies Latest reply on Feb 11, 2010 8:53 AM by Marx

    Text Finder



      Text Finder


      Is there a way to create a script that will work with a global to find text (a word within a text box). I have created a help page that list all of the work code definitions for my database. I have over 1000 work codes and would like to have a search so they can find the code and see the definition. I know you could use the find/replace menu function but I would like something right there in front of them because I plan on shutting down as much of the menu bar as I can for the users.



        • 1. Re: Text Finder

          You can script the Find/Replace command in all of its interactive forms just as you can scrip the Find (query) of FMP.


          Most users would use a global field for the search criteria.

          • 2. Re: Text Finder

             Having problems with the script. I made the gworkcode and wrote the following script do know where I am going wrong?




            go to layout

            enter find mode

            set field [dbe listing::gworkcode]

            perform find



            Thank you for your help

            • 3. Re: Text Finder



              Assuming that your table is "dbe listing" and your global field is "gworkcode", and further calling the field you are trying to search "datafield"


              kilbot wrote:

              go to layout [ layout you want to go to ]

              enter find mode

              set field [ Datafield ; dbe listing::gworkcode]

              perform find

              You told FMP what you wanted to set the field to...but not what field you wanted set.

              • 4. Re: Text Finder

                Thanks but this is where I am lost. I'm not really searching a data field, I'm just searching for some text that has been pasted into a layout. Basically I trying to do the same thing as the find/replace command under the edit menu. I just trying to have it right above the list of text so users don't have to access the menu bar.


                Let em know if I headed in the right direction or what i could do, I appreciate all of your help.

                • 5. Re: Text Finder

                  You do not need "Find Mode".


                  The only step "required" in this new script is "Find/Replace" - there is a dialog that is identical to the interactive find/replace.


                  In that dialog you can specify by calculation the global field and indicate the type of find etc.


                  Attach this script to a button or onobjectexit trigger to the global field for automatic execution.


                  Hope this is the direction you are seeking.  

                  • 6. Re: Text Finder

                    Thank you, I understand where your going with this now but what calculation do I specify to make the find look for what is text is placed in the gworkcode field. I picked that field in the specify box and place the script on a button but it only went to the gworkcodes field not to the text below which is not in a field at all just pasted to the layout.


                    Thank you

                    • 7. Re: Text Finder

                      The "Find What" is where you specify your global field.


                      Find/Replace behavior will vary from layout to layout based on several factors.


                      It is most commonly used when the layout is list or table view but it will perform in form view - it is easier to debug the script behavior in list or table view.  


                      Is the data you want to search in fields of the table that the layout is assigned to and are they visible on the layout?


                      What are your choices in the scripted script step "Perform Find/Replace", i.e. Current Field, All Fields, Current Record, All Records, etc.? 


                      Did you check the "Perform without dialog" option?  It needs to be checked.