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!

StoreVar and FetchVar Functions in CR 2008

Status
Not open for further replies.

yosteevo

IS-IT--Management
May 8, 2012
42
0
0
US
I am using Crystal Reports 2008.

I need to assign the calculated value of a formula to a Shared Variable that is configured within a subreport that is configured in a main report.

I then want to have the ability to recall the value of my formula calculation contained in my subreport in order to use that variable's value in other formulas in my main report.

(Similar to StoreVar and FetchVar Functions from earlier versions of Crystal Reports)



I have succeeded in creating a formula that assigns a value to a Variable within my subreport with the following syntax:

Shared NumberVar Ring1_AV_Store_Calculation;
Ring1_AV_Store_Calculation := {@AV Calculation for Both S1_S2}



Now I need help with the syntax and the process that fetches the value into the main report.
I have come across StoreVar and FetchVar Function tutorials online but they no longer work in Crystal Reports 2008.


Thanks
Stephen


 
Add WhilePrinting records to the first line of your subreport formula as follows:

WhilePrintingRecords;
Shared NumberVar Ring1_AV_Store_Calculation;
Ring1_AV_Store_Calculation := {@AV Calculation for Both S1_S2}

Then in your main report wherever you want to use that value from the subreport, add the following lines to the beginning of each formula:

WhilePrintingRecords;
Shared NumberVar Ring1_AV_Store_Calculation;

You can then perform whatever calculation upon want on that variable.

Remember, the variable won't be available in the main report until a section below the subreport, and the variable must be declared in every formula it is used.

Hope this helps.

Cheers
Pete
 
Thanks Pete,

I did have the correct syntax.
I just needed to import another copy of my subreport in my main report's header and suppress all the sections within the subreport copy.



Stephen
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top