Unable to pass variables from subreport to main report.
Reproducing the Issue
Crystal Report Developer Version : Crystal Reports Designer XIR1 / XIR2 / 2008.
Operating System: Microsoft Windows XP / 2000 / 2003 Server / Vista.
- Create a crystal reports using Xtreme Sample Database.
- Use "Customer" table for the main report and insert a sub report and place the sub report in group footer.
- Create a formula declare and initialize the value as shared variable in the subreport.
shared numbervar total:= 100;
- Create a formula in the main report and declare the same shared variable and place the formula in the group footer next to the subreport.
shared numbervar total;
When we use a shared variable in a particular section and pass this variable to the main report and display it in the same section, then we find that the variable does not pass the value as a shared variable.
To rectify the problem, ie) for the proper functioning of the shared variable we have to follow the below steps..
Declare a variable as shared while writing the formula in a subreport and place the formula in the sub report
Use the same variable in main report which was declared as shared in subreport.
Insert a new section below the sub report and place the main report formula in the new section.
Goto > Section Expert in the main report > Select the sub report section > Select "Underlay Below Section".
Now create a manual running total using that variable.