Also, notice that if you want to operate on total from different months, you'll have to create as many variables as months will fill the listing (not possible in many cases).
As the defualt behavior for report variables is to accumulate (or perform some calculation on) values, that can be resetted on each page, group, etc, the only way to mantain ALL the values will be to accumulate the detail value in ALL cases dependng on the field.
Indeed, not a very good idea.
An example wwould be:
Allways Sum
Variable Value to Store
--------------------------
rnMonth1 iif( nMonth=1, nAmount, 0 )
rnMonth2 iif( nMonth=2, nAmount, 0 )
rnMonth3 iif( nMonth=3, nAmount, 0 )
...
rnMonth12 iif( nMonth=12, nAmount, 0 )
Generally, is better to preprocess that information prior to print the report, as in:
select sum( nAmount ) ;
from ThatTable ;
group by nMonth ;
into array laMonthTotal
report form ThatReport ...
At the report footer, you can operate with laMonthTotal values. Again, it is preferable that you perform the operations first. That way you have control over how many months you're dealing wwith, and such things.
Hope this helps.
>Yes you can. The report writer allows you to create variables.
>Instead of creating normal totals for your columns create and use variables that will contains these totals.
>Then you can use these variables exactly how you describe.
>Click on the report menu and choose variables to start the process.
>Make sure you have all the neccesary report toolbars open (layout and report tools)
>
>>If in a report, I created a group, for example, group by month of a date field.
>>Then I sum a price field, can I put the different sum of different month into a variable so I can use them in a formula at the bottom of the report?
>>For example,
>>Jan
>>Mr. A $10000
>>Mr. B $20000
>> Sum1= 30000
>>Feb
>>Mr. A $2000
>>Mr. B $3000
>> Sum2= 5000
>>----------------------------
>> X = Sum1*0.4 + Sum2*0.6 <----- Do some operation by using the sum.
>>How can I obtain sum1 and sum2?