>I have this project and it requires the calculation of profit/loss for a company. What they want is to have a certain number of records marked by a code listed on a grid. At the end of those records, they want a summary line item showing the calculation for those items (indicated by a NULL or X to show it is a summary line). Then of course for the process to continue with another group code and it's summary line item.
>
>
>DESCRIPTION CODE AMOUNT
>
>DVD INCOME 410 50000
>DVD LOSS 510 10000
>GROSS DVD INCOME NULL 40000
>VHS INCOME 420 50000
>VHS LOSS 520 60000
>GROSS VHS INCOME NULL -10000
>ADMINISTRATIVE 610 40000
>SALES 710 30000
>TOTAL OFFICE NULL 70000
>
>Any suggestions would be helpful. Thanks!
You could do this easily in a report. You'll need to add a few fields to the table if they aren't already there - A Grouping field, an Order field and a Profit/Loss field. If you use negative numbers for the loss you won't need the Profit/Loss field.
Group your data in the report by the Grouping field and summarize the amounts in the group footer with a report variable.
If you need to display in a grid, you can use the new fields I mentioned to create the summary lines in a second cursor using a SQL SELECT, then use a SQL SELECT with a UNION to create a cursor grouped and ordered appropriately.
David.