SearchResults

Add More Tables To Search

How can I search on more than the two tables mentioned in the Integration instructions?

Adding Tables 3 and 4.

SearchResults ships with support to search 4 different tables, so all you need to do for the next two is create layouts for them like you did for Table01 and Table02. Then edit the script "Search", finding the comment "Perform search in each context" and editing the Go To Layout steps that follow to point to your Table03 and Table04 layouts.

Adding More than 4 Tables.

If you need to search more than the 4 tables SearchResults is prepped for, you can easily extend it to search additional tables. Here's how...

1. If you haven't already integrated SearchResults into your file, do that first.

2. Open your relationship graph and click the "+" tables button in the lower left to add a new table occurrence to the graph. Select the data table you'd like to search (something like "payments" for instance) and change the table occurrence name to "Search Table 05" (without the quotes) or whatever the next highest SearchResults layout number would be. Click OK to leave the relationship graph.

3. Create a new blank layout in your file and name it "Table05" (without the quotes) and change "Show Records from" to be the new layout you created in step 2 above.

4. Now go to your original copy of SearchResults (email us if you need a fresh copy), enter layout mode, and select all the contents of the Table00 Template layout. Copy this and paste it into the new layout from step 3. Click "OK" if FileMaker wants to expand the size of the layout.

5. Point the fields on this layout at the relevant fields from your table, just as you did when originally integrating the file. If you don't remember doing this, you were following step 7 in the Integration instructions.

6. We're almost done, just a couple scripts to edit. Edit the script "Search" and find the section following the comment "Perform Search in each context." And a new set of "CONTEXT" lines:

A Go to Layout step that goes to "Table05", and
A new Perform Script step that calls the "Search - Iterate" script with the parameter "05".

7. Edit the script "Integration Setttings".

Find the comment "Name your contexts" and create a new set variable line for your new context. In our example this would set the variable "$$sr Context 05" (without the quotes) to "Payments".
Find the comment "Select which layouts to use when clicking on results: Form Views" and add an Else If() for your new context, going to which ever layout in your file represents a form view of a record from your new context (a payment form view in this example).
Do the same thing a few lines below after the comment "Select which layouts to use when clicking on results: List Views".

That's it!

(855) SEEDCODE
[email protected]
Follow us: