Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Sub Report data vanishing Post Reply Post New Topic
Author Message
CrysN00B
Newbie
Newbie
Avatar

Joined: 22 Dec 2014
Location: United States
Online Status: Offline
Posts: 3
Quote CrysN00B Replybullet Topic: Sub Report data vanishing
     Posted: 22 Dec 2014 at 7:10am
To start,
Our company uses a construction software which uses Crystal to process all its reports. I have Crystal 2011 for the purpose of creating some reports and modifying some existing "canned" reports that come with the system.
I have a billing report (from the system) with a subreport in the GH3b. The report runs fine as is, but I have been asked to add a field to one of the formulas. The table is already selected and linked, so I opened the sub report and added the field I wanted to the sum in the formula.
Original Formula:
{@TotalPosCo}+{@TotalNegCO}
My Formula:
{@TotalPosCo}+{@TotalNegCO}-{@CurrPCO}

I'm not sure why, but when I rerun the report after making this modification, all data fields are blank in the sub report, not just formulas, it's like it pulls nothing from the DB for the sub report. The main report detail fields remain intact and correct, just the sub report breaks.

My CurrPCO field is represented in the main report PH and the @CurrPCO is represented in the Main Report Details.
What am I missing, why does the subreport go blank? What link am I breaking by modifying that canned report?

Thanks in advance for your help.
--Ben

IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 22 Dec 2014 at 7:51am
are you creating a shared variable formula (@currPCO) and passing this down to the sub report?
 
If you are using in some sort of linking process that would likely cause all of the ata to disappear.
The shared variable does not need to be linked.
 
Also if the sub report had a dormant table in it that you are some how now inclucing as part of the 'active' joins it could do the same thing.


Edited by DBlank - 22 Dec 2014 at 8:32am
IP IP Logged
CrysN00B
Newbie
Newbie
Avatar

Joined: 22 Dec 2014
Location: United States
Online Status: Offline
Posts: 3
Quote CrysN00B Replybullet Posted: 22 Dec 2014 at 9:03am
Initially there was not a shared variable.
Incorrect Working Code (ie this is what they had from a previous developer, it compiled and came up with the right data, but I know it's wrong):
if {JCCI.udG703Grouping} = 'X' then {JBIS.CurrContract}+{JBIS.ChgOrderAmt} else 0

This was then summarized in GH3b on the main report and manipulated in the same field as the sub report to align with the sub report. When the sub report was drilled down, because this total was in the main report only, it would vanish.

My "fix" to try to pass the variable:
Modified code in @CurrPCO formula to:
Shared CurrencyVar PCOCurr;
if {JCCI.udG703Grouping} = 'X'
    then PCOCurr:={JBIS.CurrContract}+{JBIS.ChgOrderAmt}
    else PCOCurr:=0;

Then, in the subreport, I setup @PCOData:
Shared CurrencyVar PCOCurr;

Admittedly, I have no idea what this Summary is doing but it actually has the correct total. My "Fix" actually crashes the report "Loading Crystal Assemblies and report Template....failed: Load Report Failed" The statements do save without error.

So, long story short (too late) I am trying to fix this by creating a shared variable passed to the sub, but it's not working.
thanks for your time.
--Ben

IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 22 Dec 2014 at 9:12am
you need to pass the correct group value into each sub report, correct?
 
you will want 3 variable formulas in the main report
one to se teh value to 0 (in  the gh)
one to do your conditional sum (details section)
one to get the final value for the group (group footer).
this is then the value you want to pass to the sub report.
The sub report must be on a section below where the final group value is located - eg. shared variable in main report is on GF1a and sub report is on Gf1b.
 
IP IP Logged
CrysN00B
Newbie
Newbie
Avatar

Joined: 22 Dec 2014
Location: United States
Online Status: Offline
Posts: 3
Quote CrysN00B Replybullet Posted: 23 Dec 2014 at 3:35am
Ok, I'm halfway there...
Report no longer crashes with my code and it passes a variable, but it's not calculating (ie, it's passing 0, not the $2800 amount I'm expecting).
Now I just need to edit the math or figure out what's not firing on the calculation side.
But the variable is passing and the data isn't blanking out...haha, Christmas Win!!

Thanks for your help.
--Ben
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 23 Dec 2014 at 3:56am
did you place one variable formula in the detail section?
Also, unhide all of the in the main report to try and see what is being calculated. easiest to watch each row to see what the code is actually doing.
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