Once you have a found set, you can summarize it in a variety of ways. Using summary fields, you can count how many records were found and print the count in a report. You can create totals, averages, minimums, and maximums of number fields. If you are statistically inclined, you can even create standard deviations.Layouts with summary fields require a little more planning than those without them. A summary field is unique in that the same field will display different values, even in the same layout, depending on which part it appears in. A summary field defined as a total in the Trailing Grand Summary will display the total of that field for the entire found set. But the same field in a sub-summary layout part will only display the total for the sub-summary part.
To create summary fields
1 .Choose File > Define > Database (Control+Shift+D/Command+Shift+D).2 .When the Define Database dialog box appears, click the Fields tab.3 .From the list of fields, click the field to be summarized.4 .Click Duplicate to make a copy of the field. Edit the copied field name by adding "Summary" to the end of it.5 .From the Type drop-down list, select Summary (Control+S/Command+S) (Figure 5.9). Click Change.
Figure 5.9. Use keyboard shortcuts to select your field type.
6 .When the Options for Summary Field dialog box appears, choose the type of summary you want (Figure 5.10). Click OK.
Figure 5.10. In the Options for Summary Field dialog box, you choose both the field to summarize and the form the summary will take.
TipSummary field options can be very useful. A summary field "Tax Amount Summary" set to "Total of" may add the sales tax for several records to tell you how much money you owe the state. The same summary field set to "Count of" tells you how many of those records have a sales tax entry in them.
To create a layout with summary parts
1 .Choose View > Layout Mode (Control+L/Command+L). Choose New Layout (Control+N/Command+N).This automatically starts the Layout Assistant. Based on the choices you make, the Layout Assistant creates the layout parts you need and places fields and their labels in a logical place within the parts.2 .In the New Layout/Report dialog box that appears, type a name for the layout and choose Columnar list/report as the layout type (Figure 5.11). Click Next.
Figure 5.11. The Layout Assistant automates the process of creating a new layout.
3 .Click the "Report with grouped data" radio button. Check the Include Grand Totals box if you want totals for the entire report to appear (Figure 5.12). Click Next.
Figure 5.12. This layout example will include Grand Totals at the end of the report.
4 .In the Specify Fields dialog box, double-click each available field to be included in the Body part of the report in order to place it in the Layout fields list. This example uses the Full Name, Sale Amount, Sales Tax, and Sales Total fields (Figure 5.13). When youve chosen your fields, click Next.
Figure 5.13. Add the fields that are not summaries to the Body part of the report.
5 .In the Organize Records by Category dialog box, just click Next.6 .If you want to sort by any of the report fields listed in the Sort Records dialog box (Figure 5.14), double-click to select them. If you dont want to sort the report or if youre going to sort by other fields, leave the Sort order list empty. Click Next.
Figure 5.14. If you want to sort the report by one or more fields, choose them from the "Report fields" list.
7 .In the Summary field section of the Specify Grand Totals dialog box, click Specify (Figure 5.15). When the Specify Field dialog box appears, select a summary field.
Figure 5.15. This step adds the Summary fields that will display the grand totals in the Grand Summary part.
If you havent yet created your summary fields, you can do so now by choosing Define Database from the drop-down menu in the Specify Field dialog box (Figure 5.16).
Figure 5.16. If you havent created your summary fields before starting the Layout Assistant, you can do so in Specify Field.
8 .From the "Grand total placement" drop-down menu, choose the position on the layout where you want the grand totals to appear (Figure 5.17).
Figure 5.17. Choose the layout position for the summary totals from the "Grand total placement" drop-down menu.
In this example, the totals will appear as a Trailing Grand Summary at the end of the report because we chose "End of report" from the drop-down menu.9 .Click Add Grand Total to put the summary field into the Grand totals listing.10 .Repeat Steps 7-9 to select each of the summary fields you want to use. We use summary fields that total sale amount, sales tax, and total sales (Figure 5.18).
Figure 5.18. Click Add Grand Total to place your summary field on the new layout.
11 .In the Select a Theme dialog box, choose a color scheme for your report.If youre going to print the report on a black-and-white printer, play it safe with Standard (no colors), or choose one of the themes with the word print in its title (Figure 5.19). Click Next.
Figure 5.19. You can specify a color scheme for the report. If youre printing on a black-and-white laser printer, choose one of the print versions of the layout themes, or the black-and-white Standard.
12 .In the Header and Footer Information dialog box, add any items like page numbers and date stamps that you want to include in a specific place on the report by selecting them from the drop-down menus (Figure 5.20). Click Next.
Figure 5.20. For a multiple-page report, you can add page numbers and titles to the footer or header.
13 .To automatically create a script that will go to the layout with the summary, re-create the sort order you used and display the report in Preview mode, click the "Create a script" radio button and type a name for the script (Figure 5.21). (If you dont type a name, FileMaker will insert the layout name here.) If you dont want a script or plan to create your own, click "Do not create a script." Click Next.
Figure 5.21. You can create a script for this report automatically.
14 .If you want to see the report immediately, click the "View the report in Preview mode" radio button. If you want to fine-tune the layout, click "View the report in Layout mode" (Figure 5.22).
Figure 5.22. In Layout mode, you can fine-tune your report by reformatting fields and adding text.
15 .Click Finish to close the dialog box.Depending on which choice you made, your layout will be displayed in either Preview or Layout mode.