1 .Choose View > Layout Mode (Control+L/Command+L).2 .Choose Layouts > New Layout/Report (Control+N/Command+N). In the New Layout/Report dialog box, type a name for the layout. For this example, we'll use Date Find.3 .Choose "Blank layout" as the layout type and click Finish (Figure 9.1).
Figure 9.1. Since only one field will be used in this layout, choose "Blank layout."
4 .Drag the Header and Footer parts up until they disappear, since we only need the Body part.5 .Drag the Field tool into the layout. In the Specify Field dialog box that appears, choose your date field. Here, we add Sale Date (Figure 9.2).
Figure 9.2. Choose the field for the find criteria in the Specify Field dialog box.
6 .Using the Text tool, add directions on how to use the layout and arrange the text and field on the layout page (Figure 9.3).
Figure 9.3. Add directions in the layout to explain how to use it.
Next we'll create the script to do the Find request and print the result.7 .Choose Scripts > ScriptMaker (Control+Shift+S/Command+Shift+S). In the Define Scripts dialog box, click New. In the Edit Script dialog box, type a name for the script. (We use Print Sales Report.)8 .In the step list on the left, double-click Go to Layout.9 .Under Script Step Options, choose the layout you just created from the Specify drop-down menu (Figure 9.4).
Figure 9.4. The first step in this script switches to the Date Find layout.
10 .In the Navigation section of the step list on the left, double-click Enter Find Mode. Leave the Pause box checked (Figure 9.5).
Figure 9.5. The script pauses to allow you to enter the find criteria.
Since the user will choose different dates each time the script runs, you don't want to use the "Specify find requests" option. The Pause option makes the script wait for input before continuing.11 .In the Found Sets section of the step list on the left, double-click Perform Find (Figure 9.6).
Figure 9.6. Since you'll enter new find criteria each time, don't use the Specify option.
12 .If you want your report sorted a specific way, double-click Sort Records in the Found Sets section. Under Script Step Options, check the "Perform without dialog" check box.13 .Click the "Specify sort order" check box. When the Sort Records dialog box appears, double-click the field(s) to sort by in the list on the left (Figure 9.7). Drag them up or down to arrange them in the order of the sort, then click OK.
Figure 9.7. If the script will use a sort, you can specify it in the Sort step.
14 .In the step list on the left, scroll up to the Navigation section and double-click Go to Layout.15 .Under Script Step Options, choose the layout in which you want the found set to appear from the Specify drop-down menu (Figure 9.8).
Figure 9.8. This script will switch to the Sales Report layout before printing.
16 .Scroll down to Files in the step list on the left, then double-click Print Setup. Check the "Perform without dialog" check box. Click the "Specify page setup" check box. When the Page Setup dialog box appears, choose the options to be used when printing the report (Figure 9.9). Click OK.
Figure 9.9. The Print/Page Setup option will create the correct print settings.
17 .In the step list on the left, double-click Print. If you want to see the Print dialog box, uncheck the "Perform without dialog" box. Click the "Specify print options" check box. In the Print dialog box, choose FileMaker in the drop-down menu. Set the Print option to "Records being browsed" (Figure 9.10). Click Print.
Figure 9.10. "Specify print options" must be set to print "Records being browsed."
18 .In the Found Sets section of the step list, double-click Show All Records.This will reset the database to All Records after you've finished printing the found set.19 .In the Navigation section of the step list on the left, double-click Go to Layout. Leave the options as they are (Figure 9.11).
Figure 9.11. Use the Go to Layout step to return to the layout you were in when you ran the script.