Partager via


One-To-Many Report Wizard

You can create a report that groups records from a parent table with records from a child table, for example, names and address from a Customer table and amounts and discounts from an Orders table, using the One-To-Many Report Wizard. For information about starting the One-To-Many Report Wizard, see How to: Create Reports and Working with Reports.

Step 1 - Select Parent Table Fields

In this step, you choose a free table or table or view from a database that will provide the controlling fields data presented in your report. This specifies which field of the parent or controlling table determines the records selected in the child or controlled table. You can select fields from a single table or view only.

Step 2 - Select Child Table Fields

In this step, you choose the fields from the related table. This step determines which fields from a child or controlled table are displayed on the form. For example, the parent table might hold only customer names, ID numbers, and addresses, and the child table might hold orders information, such as ID numbers, amount, date, discount, and so on. One customer might have many orders.

You can select fields from a single child table or view only.

Step 3 – Relate Tables

In this step, you specify from the fields list how the parent and child tables are related. In the example from step 2, both tables contain the customer ID field, so that is one way to relate them. There might be other ways depending on the available fields and what you want to report.

Step 4 – Sort Records

In this step, you can select in the parent table the fields in the order that you would like to sort the records. For example, if you are using two fields and have a first name field and a last name field, then you could choose to sort on first name+last name (such as PaulWilson) or on last name+first name (such as WilsonPaul). How you sort is determined by the order in which you selected those fields.

If your table already has one or more indexes, you can select the index tag, which is listed below the fields, separated by a line, in the Available fields window.

Step 5 - Choose Report Style

In this step, you can choose the basic format of your form from the styles built into the wizard. When you click any of the styles, the wizard updates the graphic in the magnifying glass as an example of the style.

The Summary options button makes it possible for you to specify whether your report will include one or more calculations, such as sum or average, on available fields.

You also can choose whether your report will display or print in portrait or landscape orientation.

Step 6 - Finish

In this step, you can choose how and when to use the report.

  • Save report for later use
    Makes it possible for you to save the report as a file, which you can open later.

  • Save report and modify in the Report Designer
    Saves the report as a file and then opens it in the Report designer, so you can make modifications to it.

  • Save and print repor t
    Saves the report as a file and then immediately prints it.

If you select Use display settings stored in the database, then your report uses information from the database.

If the number of fields you selected cannot fit on a single line within the width of your report, the fields will wrap to the following line. If you do not want the fields to wrap, clear the Wrap fields that do not fit check box. Click the Preview button to view the report without exiting the wizard.

After you save the report, you can open and modify it like any other report in the Report designer.

See Also

Reference

Report Wizard

Other Resources

Wizards (Visual FoxPro)

Working with Tables (Visual FoxPro)