Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Store and Fetch!!!!!!!

Status
Not open for further replies.

MrHelpMe

Technical User
May 1, 2001
203
0
0
CA
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.
 
The first formula is irrelevant, you can delete it.

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
On-site custom Crystal Reports Training and Consulting.
Quick Reference Guide to using Crystal in VB.
 
Salvatoref: I think you have not understood the use of the store and fetch process. Storenumbervar will store the value you choose with whatever frequency the section you place it in will print i.e. if you put it in the report header/footer only once, if you put it in the details once per record. The same with 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
Accredited Crystal Decisions Enterprise Partner
 
dcm,

Since he stored the grand total of the subreport, he shouldn't need accumulation. Ken Hamady
On-site custom Crystal Reports Training and Consulting.
Quick Reference Guide to using Crystal in VB.
 
Hi Ken,

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
 
Ah, I see. The subreport is for EACH representative separately. This means that each time the subreport runs you will store one total, simply replacing one total with another each time you store. When you finally fetch, you will only fetch the last one stored.

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
On-site custom Crystal Reports Training and Consulting.
Quick Reference Guide to using Crystal in VB.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top