Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Complicated report
Message
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Miscellaneous
Thread ID:
01341240
Message ID:
01341494
Views:
23
>I could use some help thinking through how to create a fairly complex report. There are many tanles involved but it basically boild down to a budget and expense report for a collection of projects. Each project has an ID that looks like this. RTA-12, RTA-23, RTA-22a, RTA-22b, etc. The RTA- prefix is uniform with all the projects. The numeric portion of the ID represents a group that the project belongs to. Group 12, Group 22, etc. The parent table in this case identifys the project and there are child tables for the budget and expenses. The budget table is a one to one, and the expense table is a one to many. The report needs to produce a single line that summarizes the total budget and total expenses like this:
>
>Group Budget Expenses
>1 400 250
>22 800 650
>
>I have been able to deal with the expense portion by creating a cursor with a record for each expense and grouping the report on the Project Group. Then using the group footer to subtotal the expenses. But I am not at all clear on how to add the budget information.
>
>Any thoughts would be appreciated.

If you are "driving" the report from the Expense cursor, you could set relations to the budget table/cursor based on Group. Then in the Group Footer you can reference BudgetTable.BudgetField.

Another option is to build one cursor that joins the data and just print the data in the detail band.
SELECT Group.GroupID, NVL(Budget.BudAmt, 0) AS BudAmt, NVL(ExpSumData.ExpAmt, 0) AS ExpAmt ;
  FROM Group ;
    LEFT JOIN Budget ON Budget.GroupID = Group.GroupID ;
    LEFT JOIN (SELECT GroupID, SUM(ExpAmt) AS ExpAmt FROM Expenses GROUP BY GroupID) ExpSumData ;
        ON ExpSumData.GroupID = Group.GroupID ;
   ORDER BY GroupID
Cathy Pountney, Microsoft Visual FoxPro MVP
Memorial Business Systems, Inc. (www.mbs-intl.com)

My Website: (www.frontier2000.com)
My Blog: (www.cathypountney.blogspot.com)
My Book: The Visual FoxPro Report Writer - Pushing it to the Limit and Beyond
Free MSDN Article: What's New in the VFP 9.0 Report Writer
Free MSDN Article: The VFP 9.0 Report Writer In Action
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform