Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Income Statement
Message
From
03/01/2009 16:27:24
 
 
To
03/01/2009 10:56:05
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows XP
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01370795
Message ID:
01370853
Views:
25
>>Unless I've missed something ..... Before you run the report you can "create a memory variable which sums up the total sales categories."
>>SELECT SUM(sales) FROM myCursor INTO ARRAY aSalesTot
>>
>>aSalesTot will be in scope when you run the report.
>>
>>
>
>Don't forget the GROUP BY category clause to seperate the categories to different array positions. Also the ORDER BY clause is needed to insure a known order of the array. In the Field List section, add the Category field so you can locate the right position in the array.
>

I didn't forgot it. If I can help someone, I normally try to answer questions in the context in which they are asked. The context of the original specification seemed fairly explicit that grouping by category was wrong since the detail lines were sales/expense totals for each category.

Thus ..... "In this case, the total for all sales is 33183.00. That amount will become the denomenator for all the ratio calculations in the report."

No mention of separate denomenators for each category. If more than one denomenator is needed, I would take a different approach and merge the data before running the report. Something like........
SELECT mc.*,cd.denomenator catdem,totdem.totsales;
   FROM myCursor mc;
      JOIN (SELECT category,SUM(sales) denomenator FROM myCursor GROUP BY category) cd;
          ON mc.category = cd.category;
      JOIN (SELECT SUM(sales) totsales FROM myCursor ) totdem;
   INTO CURSOR curReport
>>
>>
>>>Thank you but I want to create a memory variable which sums up the total sales categories.
>>>example:
>>>
>>>sales cat 1 521.00 1.57%
>>>sales cat 2 6525.00 19.66%
>>>sales cat 3 3625.00 10.92%
>>>sales cat 4 22512.00 67.84%
>>>
>>>Total Sales 33183.00 100.00%
>>>
>>>expense cat 1 2252.00 6.79%
>>>expense cat 2 2525.00 7.61%
>>>expense cat 3 3987.50 12.02%
>>>expense cat 4 2365.52 7.13%
>>>Total expenses 11130.02 33.54%
>>>
>>>Net Profit (Loss) 22052.98 66.46%
>>>
>>>In this case, the total for all sales is 33183.00. That amount will become the denomenator for all the ratio calculations in the report.
>>>
>>>521.00 / 33183.00 = 1.57%
>>>33183.00 / 33183.00 = 100.00%
>>>3987.50 / 33183.00 = 12.02%
>>>22052.98 / 33183.00 = 66.46%
>>>and so on.
>>>
>>>I believe the calculation must be made in an additional detail band, but I am having trouble obtaining my desired result.
>>>
>>>GSD
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform