3 Replies Latest reply on Apr 24, 2014 6:27 AM by philmodjunk

    Scripted Find Problems



      Scripted Find Problems


           I used the information provided in http://forums.filemaker.com/posts/3a02f9dc28


           I have a a table for clients and another table for related contacts.  I'm looking to create a search method that will search a single box for a match in either table and return the results as client name, client city, contact last name, contact first name.

           When a user selects one of the rows in the results it will write that data to appropriate fields in a different layout.

           I started with New Layout

           I based the layout on clients (but they are related via a relationship to contacts)

           I added one field gName which is a global field name (was I supposed to relate that to something?)

           I then typed in the steps in the perform find 

      Go To Layout [Select a layout based on table being searched]
      Enter Find Mode [] ---> clear the pause check box
      Set Field [YourTable::YourField ; Globals::gField]
      Set Error Capture [on] ----> Keeps error dialog from interrupting script when no records are found
      Perform Find []
      If [Not Get ( FoundCount ) // no records were found ]
          Show Custom Dialog ["No records were found by this search."]
      End IF

      When I run the script nothing seems to happen.

        • 1. Re: Scripted Find Problems

               If this is the whole script, it won't do what you are looking to do.  For starters, you have to put a value in gField. It appears the gField is where you will type your find criteria, then trigger the script.  gField is a global field in the Globals Table.  Do you have a Globals Table set up?

               This script will only search one field in oneTable

          • 2. Re: Scripted Find Problems

                 Posting the actual script with the actual details would help. There are any number of picky details that if not set up correctly, will keep the script from working as expected.

                 But you also want to search two different tables with the same criteria and apparently want to list the matching record from both tables. That will be tricky to do as FileMaker only pulls up matching records from a single table--the table on which the current layout is based. From what little that you describe here, it's quite possible that you shouldn't have two tables like this--each with names in the first place, as it might be possible to treat your clients as one kind of contact in your contacts table.

            • 3. Re: Scripted Find Problems

                   To post a script to the forum:

              1.           You can upload a screen shot of your script by using the Upload an Image controls located just below Post a New Answer.
              3.           You can print a script to a PDF, open the PDF and then select and copy the script as text from the opened PDF to your clipboard for pasting here. (with this approach, you can get multiple script steps on the same line, please edit the pasted text by inserting some returns to separate those steps.)
              5.           If You have FileMaker Advanced, you can generate a database design report and copy the script as text from there.
              7.           If you paste a text form of the script, you can use the Script Pretty box in the Known Bugs List database to paste a version that is single spaced and indented for a more professional and easier to read format.