Solved

Calculated field based on subreport ... AGAIN

Posted on 2014-11-19
2
175 Views
Last Modified: 2014-11-19
I thought this was working correctly, but it's not.  I'm having difficulty getting a field from my subreport and using it in a formula in my main report.

In my subreport, I have a formula called Subreporttotal in the Group Footer #1, that is :
WhilePrintingRecords;
Shared NumberVar SubreportTotal;
SubreportTotal := Sum({Command.ext_recvd}, {Command.vendor_id});

In my main report I have formula called SharedNumberVar that is in the report header that is:
WhilePrintingRecords;
Shared NumberVar SubreportTotal;

In my main report, I have a formula called Impact %, that is in the Group Footer #1 @ Vendor - A section that is:
WhilePrintingRecords;
Shared NumberVar SubreportTotal;
If SubreportTotal = 0 then
    0
Else
    Sum ({@Total NC Cost}, {@Vendor}) / SubreportTotal


When I run the report, I get zeros everywhere and I can't figure out what I have done wrong.
Vendor-Issues---Summary.rpt
Vendor-Spend-Subreport.rpt
Vendor-Name-Subreport.rpt
0
Comment
Question by:ITworks
2 Comments
 
LVL 100

Accepted Solution

by:
mlmcc earned 500 total points
ID: 40452364
I found 3 issues with your implementation

1.  You didn't have a formula in the subreport that assigned a value to the shared variable.

2.  You are calculating a % but you weren't displaying any decimals so all values were rounding down to 0.  ALso since it is a % the formula needed to be multiplied by 100.

3.  Subreports are the last object evaluated in a section.  Since your formula relies on a value returned from the subreport it needs to be in a section after the subreport.  I added a GF1b and put the formula there.  To make it look like it is on the same line as the rest I set GF1a to underlay the following section.

I also changed the formula in the report header so it declares the shared variable but doesn't show any values.

The attached report has my changes.  I couldn't save it with data since apparently there is more data than was saved with it.

mlmcc
Vendor-Issues---SummaryRevA.rpt
0
 
LVL 4

Author Closing Comment

by:ITworks
ID: 40452394
Thanks so much!  I will add all of your help to my 'help file' for future reference.   This was my first report with variables.....I learned a lot from you.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Crystal Reports 11 Ignoring Parameters 3 68
Crystal Report fractions 4 68
Not Exists 3 65
New and Previous Value in Crystal Report 8 53
I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…
This is a video that shows how the OnPage alerts system integrates into ConnectWise, how a trigger is set, how a page is sent via the trigger, and how the SENT, DELIVERED, READ & REPLIED receipts get entered into the internal tab of the ConnectWise …

948 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now