Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Technical Questions
Message Icon Topic: Share NumberVar pulling incorrect data Post Reply Post New Topic
Author Message
mtapp2207
Newbie
Newbie


Joined: 20 May 2019
Location: United States
Online Status: Offline
Posts: 4
Quote mtapp2207 Replybullet Topic: Share NumberVar pulling incorrect data
    Posted: 30 Mar 2021 at 5:41am
I am using Crystal Reports 2016.

I have a report with a sub report. I pulled the subreport onto the main report and have the correct data. Once I create the formula to "share" the data, data pulls but it is incorrect data The sub report is in Group Hearder 1 and the Shared Formula is in Group Header 2.

Sub Report Formula:

WhilePrintingRecords;
Shared numberVar SqrFt := Sum ({EV821_SPACE_SETUPS.EV821_MAX_QTY})

Main Report Formula:

WhilePrintingRecords;
Shared numberVar SQRFT;


Results:   Group Header 1 = 198,000 (Correct)
           Group Header 2 - 226,481 (Incorrect
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 30 Mar 2021 at 7:13am
Is your subreport tied to the main report via a parameter? Another way of asking, is the parameter in your subreport tied to a value in the main report?

If there is no relationship between the main report and the subreport, I think that the results are unpredictable. It will probably report values for what is at the end of the report. Just a guess.

HTH
IP IP Logged
mtapp2207
Newbie
Newbie


Joined: 20 May 2019
Location: United States
Online Status: Offline
Posts: 4
Quote mtapp2207 Replybullet Posted: 30 Mar 2021 at 7:19am
The sub report is linked via the "event ID" field.

IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 05 Apr 2021 at 1:11pm
I don't know, then.
Are there more than 2 groups total?
Is it always off by 1 group?
IP IP Logged
mtapp2207
Newbie
Newbie


Joined: 20 May 2019
Location: United States
Online Status: Offline
Posts: 4
Quote mtapp2207 Replybullet Posted: 06 Apr 2021 at 9:16am
There are several groups see below

GH2a - Event id 5648     Sub Report = 1,028,008(Correct)
Gh2b - Shared number variable = 1,161,043

GH2a - Event ID 23800     Sub Report = 979,408 (Correct)
GH2b - Shared number variable = 1,109,717

GH2a - Event ID 11786     Sub Report = 979,408 (Correct)
GH2b - Shared number variable = 1,109,717
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 08 Apr 2021 at 7:53am
it is mystery to me...which is not very helpful to you.

I would try adding columns in different places on the report to see what might be going on.

Or making a variable in the subreport that displays the parameter and displaying that, to make sure that the value being passed into the subreport is what you think it is.

Often, I have written code, thinking everything was working, and when I got the wrong result, breaking down the functionality and finding that a basic assumption of mine was flawed.

HTH
IP IP Logged
mtapp2207
Newbie
Newbie


Joined: 20 May 2019
Location: United States
Online Status: Offline
Posts: 4
Quote mtapp2207 Replybullet Posted: 09 Apr 2021 at 3:55am
I got it to work. I removed everything and started from scratch. Not really sure what the difference is but at least it works. Thank you for your support
IP IP Logged
Post Reply Post New Topic
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



This page was generated in 0.016 seconds.