5 Replies Latest reply on Aug 9, 2011 9:10 AM by philmodjunk

    Creating a Search Form



      Creating a Search Form


      I am still very new to FileMaker and to "programming".  I am making great progress, but I'm stuck on making the DB more streamlined.

      I am using the Contact Management template and I would like to create a form to use as a search instead of the preinstalled search function.  Specifically, I would like a user to search using multiple criteria (they can either search by one field or using multiple fields to produce more direct results) to produce results that would appear in a nice and easy table that they could be printed or emailed.  I don't know how dynamic FileMaker is, but it would also be beneficial if you could select what fields to be printed/emailed (so this way SSNs wouldn't be blasted out in the open).

      Is there a way to make this happen in Filemaker....or better yet....is there a template that has a search form in it that I could modify to fit my DB?

      Thank you to anyone that can help out!!!

        • 1. Re: Creating a Search Form

          There are several different tasks to accomplish to get what you want here:

          1. Creating a search layout--either as part of the current layout, in a different layout or even in a small window that pops up.
          2. Creating a script that uses the criteria entered in fields of this form to find records.
          3. Presenting the records thus found in a report layout.
          4. Making the report layout dynamically configurable so that the user can specify what fields will be included in the report and which will not.


          1-3 are pretty straight forward once you acquire some basic scripting steps. Item 4 is not something that's easy to do in FileMaker. If you can set up several different layouts and allow the user to choose from those layouts, this will be much simpler to implement and the results will likely look more professional.

          Starting with items 1 and 2, you can define a set of global fields to store the criteria entered/selected by the user. These fields can be formatted with value lists and other such features to aide in data entry just like any other fields, but being global, the values entered are accessible when the database is in find mode and the data in these fields are accessible from any layout and record in your database--unlike fields that are not global.

          Here's a simple script that uses criteria entered into a single global field you can refer to as an example:

          Enter Find Mode[] //clear the pause check box
          Set Field [YourTable::YourField ; YourTable::YourGlobalField] //You can use expressions here so that operators like <, or == are part of the criteria used.
          Set Error capture [on] // keeps dialog box from interrupting your script if no records are found
          Perform Find []

          That's just a small part of what you need to get started here. To modify this script to work from mutiple fields, you can simply add more set field steps to take the data entered by the user and use it as criteria in a field in your database.

          • 2. Re: Creating a Search Form

            That really just blew my mind! :)

            Maybe I'll try a simplier way....say I still use the orginal Find Mode, but when I search, I want it to go to the table view.

            1. Is it possible to redirect the search results from the Form View to the Table View.
            2. Is there a way to adjust the page break so the table prints better.  It constantly cuts off and doesn't look professional at all.
            3. Can I add a couple buttons to the table view (i.e. print, email, go to previous layout).  I can't seem to adjust anything when it is in the Table View.
            Thank you for all your help and expertise!  I hope this way is simplier one! :)
            • 3. Re: Creating a Search Form

              There are script steps for changing the view so if you use a script to perform the find it can change the view or change layouts to display the results in a table or list view.

              I'm not a real big fan of setting up table view for regular use by the users. There's a number of ways users can get into trouble by changing view settings. I prefer to set up a similar arrangement using List View where I can keep tighter control over what the user can use.

              If you want to use Table View, you can open layout setup... click the view tab and find a place where you can change settings for table view. One of those settings makes the header of the layout visible and now you have a place where you can put buttons such as you've requested.

              For page breaks, you might experiment with list view. You can specify that the body not split over a page break and in list view, you can make the body one row of data tall.

              • 4. Re: Creating a Search Form

                So I clicked for a header for table view, but I can't get to layout mode with the table visible to add buttons.  I get locked into form view.  I know this is probably an easy fix that I can't find, but can you please direct me on how to get to layout mode so I'm actually on the table view to edit.


                Thank you so much!

                • 5. Re: Creating a Search Form

                  What looks like "form view" is actually layout mode. While the body will look nothing like what you see in table view, the header will look exactly like what you'll see in table view. You can thus set up the header by adding buttons etc to it while in layout mode. You can change the size of the header by dragging it's lower boundary up and down. You can even change the background color by clicking the header label and selecting a color from the drop down.

                  When you return to browse mode, the body will change to what you expect for table view, but the header will stay the same since you've chosen that option for table view.