Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Shared Variables between Subreport and Main report Post Reply Post New Topic
Author Message
jerry911
Newbie
Newbie
Avatar

Joined: 12 Mar 2008
Location: United States
Online Status: Offline
Posts: 3
Quote jerry911 Replybullet Topic: Shared Variables between Subreport and Main report
     Posted: 13 Mar 2008 at 1:17pm
I created a report in Crystal X which has a formula calculated number in the group footer and a Subreport in the same group footer. I am trying to subtract a value from my supreport from a value on the main report, but when I add the formula shared NumberVar GP; to the sub and main report, it makes the first value 0 and the other values are reading from the previous record.
For instance
The report looks about like this
ITEM# | GP%| GP%2 (From subreport) | DIFFERENCE (formula GP%2-GP%)
101     | 25%|         35%                       |                  25
102     | 30%|         40%                       |                    5
 
For some reason, the 1st value is 0, so 25-0 = 0 and then for the next record it pull the number from the 1st record so 30-35=5
The difference should be 10 for the 1st one and 10 for the 2nd one.
Any idea why this is happening?
 
 
IP IP Logged
saoco77
Senior Member
Senior Member


Joined: 26 Jun 2007
Online Status: Offline
Posts: 104
Quote saoco77 Replybullet Posted: 14 Mar 2008 at 6:26am
I think the issue may have to do with the order inwhich Crystal Reports processes things.

The subreport needs to run before you can call a shared vairable from the subreport to the main report. If the subreport and the formula are in the same section the formula will process first.

Try completing your calculations in the section below the subreport to see if that helps.

Sarah
IP IP Logged
BanksySan
Newbie
Newbie
Avatar

Joined: 13 Mar 2008
Location: United Kingdom
Online Status: Offline
Posts: 3
Quote BanksySan Replybullet Posted: 14 Mar 2008 at 7:42am
I met a similar issue yesterday.  I added an extra section (so I had a section a and a section b).

Crystal seems to evaluate the section sin order.
"The mule with the spinning wheel."
IP IP Logged
jerry911
Newbie
Newbie
Avatar

Joined: 12 Mar 2008
Location: United States
Online Status: Offline
Posts: 3
Quote jerry911 Replybullet Posted: 15 Mar 2008 at 7:26am
Thanks...I've read that before, so after trying to place fields in different locations I finally got it to work. I did have to add a section GroupFooter b. I would have preferred to have the number within the other section, but at least it worked.
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum