Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Technical Questions
Message Icon Topic: StoreVar and FetchVar Functions in CR 2008 Post Reply Post New Topic
Author Message
Yosteevo777
Newbie
Newbie
Avatar

Joined: 23 Apr 2012
Location: United States
Online Status: Offline
Posts: 33
Quote Yosteevo777 Replybullet Topic: StoreVar and FetchVar Functions in CR 2008
    Posted: 10 Oct 2012 at 2:22pm

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

Stephen Waichulis
LIMS Database Administrator
IP IP Logged
Sastry
Moderator
Moderator
Avatar

Joined: 16 Jul 2012
Online Status: Offline
Posts: 537
Quote Sastry Replybullet Posted: 11 Oct 2012 at 2:30am
Hi
 
In crystal Shared variables will store the values and also fetch the values, these variables are global variables and can be used in your main report formulas.
 
Sample formula to store value  (in your case sub report value )
 
Whileprintingrecords;  // This formula store value to a 'xx' shared variable.
Shared Numbervar xx;
xx:={@AV Calculation for Both S1_S2};
 
 
In your main report to fetch the value, use the below formula :
 
Whileprintingrecords; 
Shared Numbervar xx;
 
This will display your sub report value in main repor.  Make sure that your sub report should get processed before you display the variable value.
Thanks,
Sastry
IP IP Logged
Yosteevo777
Newbie
Newbie
Avatar

Joined: 23 Apr 2012
Location: United States
Online Status: Offline
Posts: 33
Quote Yosteevo777 Replybullet Posted: 11 Oct 2012 at 1:29pm
Thanks Sastry,

After correcting my syntax, I also needed to import another copy of my subreport in my main report's header and suppress all the sections within the subreport copy.

I figured out that the subreport has to be at a higher level in the main report for the shared variables to calculate and become available in all lower sections of the main report.

Thanks
Stephen
Stephen Waichulis
LIMS Database Administrator
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.031 seconds.