Creating a running total in a one-to-many linking relationship

  1. From the Field Explorer dialog box, place the following fields from left to right in the Details section of your report:
{customer.CUSTOMER NAME}
{credit.CUSTOMER CREDIT ID}
{credit.AMOUNT}
{orders.ORDER ID}
{orders.ORDER AMOUNT}
  1. On the Design tab, highlight the {orders.ORDER AMOUNT} field and insert a subtotal, grouping on the {customer.CUSTOMER NAME} field.

    If you look carefully at the subtotals for each group, you will notice they aren't accurate. This is caused by the one-to-many link you created for the report. Follow the rest of this procedure to see how running totals produce accurate results in one-to-many linking relationships.

  2. On the Insert menu, click Running Total Field.

    The Field Explorer dialog box appears.

  3. Double-click Running Total Fields.

    The Create Running Total Field dialog box appears.

  4. Enter the name "CreditsSubtotal" in the Running Total Name box.
  5. Highlight {Credit.AMOUNT} in the Available Tables and Fields box, and use the first arrow button to move it over to the Field to summarize box.
  6. Select sum from the Type of Summary list.
  7. In the Evaluate section of the dialog box, click On change of field and choose the field {Credit.CUSTOMER CREDIT ID}.

    Note:    When selecting a field to be an On change of field field, choose one that is unique to the database table you are using.

  8. In the Reset section of the dialog box, click On change of field and choose the field {Customer.CUSTOMER NAME}.
  9. Click OK to save the Running Total field.

    The program returns you to the Field Explorer dialog box.

  10. Place the running total in the Group Footer section of the report.

Compare the running total amount with the subtotal amount for each group. You will see the running total is accurate while the subtotal isn't. This is why you should use a running total when your report has a one-to-many linking relationship.



Seagate Software, Inc.
http://www.seagatesoftware.com
Please send comments to:
techpubs@seagatesoftware.com