Print Page | Close Window

Shared variable skipping a line

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Technical Questions
Forum Discription: Formulas, charting data, Crystal syntax, etc.
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=22332
Printed Date: 06 May 2024 at 3:03am


Topic: Shared variable skipping a line
Posted By: sanur13
Subject: Shared variable skipping a line
Date Posted: 15 Jun 2017 at 3:59am
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.



Replies:
Posted By: kevlray
Date Posted: 15 Jun 2017 at 7:04am
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.


Posted By: sanur13
Date Posted: 15 Jun 2017 at 9:34pm
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!



Print Page | Close Window