Solved

Shared variables from subreport that are only showing last values on Main Report per group

Posted on 2015-02-03
16
580 Views
Last Modified: 2015-03-05
Hello,

I have a report with 2 Date parameter fields in the RH of the Main Report.. These are used as links to 2 subreports in addition to a  {Item} field..

Both subreports are in the GH2b of the Main report...I am using a Shared variable in each of these subreports

1st subreport @SharedAvailQty
WhilePrintingRecords;
Shared Numbervar AvailQty:=Sum ({MrpRequirement.AvailableStock}, {@@Date}, "weekly");


2nd subreport @SharedJobQty
WhilePrintingRecords;
Shared Numbervar JobQty:={MrpDetailPegging.Quantity}*-1

I am calling both of these variables in the GH2b report...I realize that is probably not right...

The subreports are displaying as example
subreport 1                                                             subreport2
Widget                                                          Widget
09/01/2013       400.00                               09/01/2013 400.00
09/10/2013      300.00
09/25/2013       200.00                               09/25/2013  200.00


but the returned value(s) to the Main report are only the last values of each subreport ..  for

MainReport     @SharedAvailQty                   MainReport    @SharedJobQty
Shared Numbervar AvailQty;                        Shared Numbervar AvailQty;

I am trying to calculate the qty's between both subreports for each date and display that on the main report..but with only the last value showing per subreport...its obviously not working
0
Comment
Question by:Mikeyman_01
  • 8
  • 6
16 Comments
 
LVL 100

Expert Comment

by:mlmcc
Comment Utility
What total are you trying to show?
In your sample is that a single Group header or is it 3?

BY the way it is shown I suspect it is a single group header.

Change the subreport formulas

1st subreport @SharedAvailQty
 WhilePrintingRecords;
Local NumberVar CurrentAvailQty;
 Shared Numbervar AvailQty;

CurrentAvailQty  := Sum ({MrpRequirement.AvailableStock}, {@@Date}, "weekly");
AvailQty := AvailQty + CurrentAvailQty ;
CurrentAvailQty 

Open in new window


Similarly for the other subreport
2nd subreport @SharedJobQty
 WhilePrintingRecords;
Local NumberVar CurrentJobQty;
 Shared Numbervar JobQty;

CurrentJobQty :={MrpDetailPegging.Quantity}*-1;
JobQty := JobQty + CurrentJobQty;
CurrentJobQty

Open in new window


mlmcc
0
 

Author Comment

by:Mikeyman_01
Comment Utility
it is picking up running totals
MRP-Custom.rpt
0
 
LVL 100

Accepted Solution

by:
mlmcc earned 500 total points
Comment Utility
Need to reset the value to 0 in the group header.

Do you realize the totals you are displaying are for the previous group.  I moved the formulas to the group footer and added a reset formula to the group header 2A

mlmcc
MRP-Custom.rpt
0
 

Author Comment

by:Mikeyman_01
Comment Utility
Well if anyone could figure it out.. You could...
0
 
LVL 100

Expert Comment

by:mlmcc
Comment Utility
Is that what you needed?

mlmcc
0
 

Author Comment

by:Mikeyman_01
Comment Utility
Yes...nicely done.. again
0
 

Author Comment

by:Mikeyman_01
Comment Utility
This report keeps crashing   'Resources not Available'  how do I fix this??
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 100

Expert Comment

by:mlmcc
Comment Utility
Is the database up?

Is this from the Crystal designer?

mlmcc
0
 

Author Comment

by:Mikeyman_01
Comment Utility
Yes the database is up... Yes it is from Crystal Designer
0
 
LVL 100

Expert Comment

by:mlmcc
Comment Utility
Try a verify database

mlmcc
0
 

Author Comment

by:Mikeyman_01
Comment Utility
I did that.. Says its Up to Date
0
 

Author Comment

by:Mikeyman_01
Comment Utility
It also looks like the bottom Records and info is all mixed up as well
0
 
LVL 100

Expert Comment

by:mlmcc
Comment Utility
Is the report running now or do you still get resources not available?

If you get the eror again can you post a screen shot of the message?

mlmcc
0
 

Author Comment

by:Mikeyman_01
Comment Utility
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
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…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

762 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

12 Experts available now in Live!

Get 1:1 Help Now