I have a Crystal Report with a sub-report located in the footer of a group.
This sub-report displays a count based on parameters passed into it.
I would like to use this value in other calculations, and so I attempted to create a shared number variable.
However, when I place the formula with the shared number variable in the main report -- next to the sub-report itself -- it appears to display the value of the previous record.
Screen-shot of main report
(business-specific information removed)
Red square is the sub-report, green square is the variable I'm attempting to print
Sub-report displays correct value, green formula displays the sub-report value of the previous record.
Screen-shot of sub-report
One formula, in the report footer:
Formula that sub-report displays
I believe this formula correctly sets the variable at the time the formula is displayed (this may be a key to the issue I'm having):
Shared numberVar tryit;
tryit :=0;
If IsNull(count({IDNumber})) then
(
0
)
else
(
tryit :=count({IDNumber});
count({IDNumber})
)
Formula that displays shared variable on main report
Shared NumberVar tryit;
tryit;
Attempt 1: Move variable to below sub-report (unsuccessful)
Craig suggested that I move the variable I want to display to a footer section below where the sub-report executes.
I tried this; however, I have no need for the sub-report to display, and when I suppress it, all the shared variables appear to become 0 due to the sub-report not executing.
Below: red box is sub-report, orange is shared variable. Works as long as sub-report is also displayed, but I have no need for sub-report and need the shared variable to do additional calculations on parent report.