Symptom
Shared variable from a sub-report displays zero when used in Bar/pie chart.
Environment
- Crystal Reports 2008
- Crystal Reports 2011
Reproducing the Issue
- Insert a Sub-Report in Main Report’s Report Footer a (RFa) section
- Create a formula in Sub-Report as below
- WhilePrintingRecords;
- Shared NumberVar t:=200;
- Call the shared variable to Main Reports as below
- WhilePrintingRecords;
- Shared numberVar t;
- Insert a Bar Chart in Main report’s Report Footer b (RFb) section
- Right click on chart , select Chart Expert
- Select Data tab, in show values(s) add the formula which is created in Main Report
- Click on OK
- Place the Main Report formula in any section of main report
- Preview the report
Resolution
Workaround 1:
- Place the Sub-Report in Report Header Section
- Then place the Bar Chart in Report Footer section
Workaround 2:
- Insert another Sub-Report in the main report that is below the First Sub-Report section
- Pass the Sub-Report 1 shared variable to Main-Reports
- From the Main Report access the shared variable to the Sub-Report2 Bar Chart
See Also
1203069 - Not all formulas appear on the Chart Expert's Data tab in Crystal Reports
1215558 - How to create a chart based on a print-time or WhilePrintingRecords() formula in Crystal Reports
This procedure is fully explained in the technical paper - Charting on Print Time Formulas
Keywords
GRAPH CHART PRINTTIME PRINT TIME WHILEPRINTINGRECORDS WHILE PRINTING RECORDS Crystal Reports Charts/Graphs Print-time formulas WhilePrintingRecords, C5156055 , KBA , BI-RA-CR , Crystal Reports designer or Business View Manager , Problem
SAP Knowledge Base Article - Public