Shared variable skipping a line

Printed From: Crystal Reports Book — Forum Name: Technical Questions

Hi everyone,

I'm using a shared variable on my report. The problem is that the variable at the main report skips a line.

Example:

Cost (subreport)      Cost (main report)
1                     0
0.5                   1
0.7                   0.5
10                    0.7
50                    10
.6                    50


So as you can see, instead of displaying 1 at the first line, the variable displays 0, and in all lines following it will display the previous record. And the last record (.6) will never show on my report. So when I add up everything, the sum is wrong.


Formulas I'm using :

Subvariable formula :

Shared NumberVar coutreel := {@Cout_reel}


Main variable formula :

Shared NumberVar coutreel;
coutreel


Any help is very apreciated,
Santiago.
Question: Is the sub-report in a section before the main variable formula?  If not, it needs to be because of how CR processes information.
No, it was in the same section. I placed it in a section before the main variable formula as you told me and it worked perfectly.

Thanks a lot kevlray!

Edited by sanur13 - 15 Jun 2017 at 9:35pm