Store and Fetch!!!!!!!
Store and Fetch!!!!!!!
(OP)
If anyone could help me it would be greatly appreciated. I am using crystal version 6 and I am trying to pass information from a subreport to the main report. I have set up three formulas:
1)Grand total main:----I placed this formula in main report above subreport(GH)
whileprintingrecords;
storenumbervar ("x", 0)
2)Grand Total Store:---placed this in the subreport
whileprintingrecords;
storenumbervar("x", Sum ({CLFU$M$S$00000007T.CURASSET}))
3)Fetch Grand Total--placed this in the main report
whileprintingrecords;
fetchnumbervar("x");
I need the formulas to store the sum for each record and display the total. However, the formula is only displaying the sum of the last value. How do I make it store all the values and then display the total of all values. I understand why it is giving me this value but I don't know how to modify the second formula.
1)Grand total main:----I placed this formula in main report above subreport(GH)
whileprintingrecords;
storenumbervar ("x", 0)
2)Grand Total Store:---placed this in the subreport
whileprintingrecords;
storenumbervar("x", Sum ({CLFU$M$S$00000007T.CURASSET}))
3)Fetch Grand Total--placed this in the main report
whileprintingrecords;
fetchnumbervar("x");
I need the formulas to store the sum for each record and display the total. However, the formula is only displaying the sum of the last value. How do I make it store all the values and then display the total of all values. I understand why it is giving me this value but I don't know how to modify the second formula.
RE: Store and Fetch!!!!!!!
For the second and third, tell us which section of the report the formula is in.
Also:
>>the formula is only displaying the sum of >>the last value.
Which formula?
Last value of which report?
Ken Hamady
http://www.kenhamady.com/
On-site custom Crystal Reports Training and Consulting.
Quick Reference Guide to using Crystal in VB.
RE: Store and Fetch!!!!!!!
It seems to me that what you need to do is accumulate the value you are selecting CURASSETS within your subreport e.g. use a variable C_ASSETS as follows:
numbervar c_assets := c_assets+CURASSETS
and then store the end result of this accumulation before fetching it in the main report
David C. Monks
david.monks@chase-international.com
http://www.chase-international.com
Accredited Crystal Decisions Enterprise Partner
RE: Store and Fetch!!!!!!!
Since he stored the grand total of the subreport, he shouldn't need accumulation.
Ken Hamady
http://www.kenhamady.com/
On-site custom Crystal Reports Training and Consulting.
Quick Reference Guide to using Crystal in VB.
RE: Store and Fetch!!!!!!!
The second formula, Grand Total Store was placed in group Header one of the subreport. The thrid formula Fetch grand total was placed in the main report under group footer 1.
When I say the sum of the last value what I am referring to is this:
I have created a subreport that calculates the current assets based on representatives from the main report. This subreport report is working correctly as it is summing all assets per representative name and displaying them. However, the store and fetch formula(mainly the fetch in the main report) is picking up that last value for the last representative, it is not subtotalling all representatives current assets. Hopefully this is clear. ie. its like saying 1+2+3+4+5 and the only value the report is picking up is the 5 not the total of all numbers(15). It is the last value of the subreport(current assests). Thanks Ken
RE: Store and Fetch!!!!!!!
You will need to create another variable in the main report and do a running total as suggested by dcm. This should use the value that is fetched and add it to the accumulating total at the same frequency as the fetch. See the FAQ on running totals for the 3-formula technique if you need more help.
Ken Hamady
http://www.kenhamady.com/
On-site custom Crystal Reports Training and Consulting.
Quick Reference Guide to using Crystal in VB.