Solved

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

Posted on 2015-02-03
16
625 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 8
  • 6
16 Comments
 
LVL 101

Expert Comment

by:mlmcc
ID: 40587328
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
ID: 40587446
it is picking up running totals
MRP-Custom.rpt
0
 
LVL 101

Accepted Solution

by:
mlmcc earned 500 total points
ID: 40587485
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
Ready to get started with anonymous questions?

It's easy! Check out this step-by-step guide for asking an anonymous question on Experts Exchange.

 

Author Comment

by:Mikeyman_01
ID: 40587537
Well if anyone could figure it out.. You could...
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 40587864
Is that what you needed?

mlmcc
0
 

Author Comment

by:Mikeyman_01
ID: 40589205
Yes...nicely done.. again
0
 

Author Comment

by:Mikeyman_01
ID: 40591641
This report keeps crashing   'Resources not Available'  how do I fix this??
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 40591845
Is the database up?

Is this from the Crystal designer?

mlmcc
0
 

Author Comment

by:Mikeyman_01
ID: 40591960
Yes the database is up... Yes it is from Crystal Designer
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 40592155
Try a verify database

mlmcc
0
 

Author Comment

by:Mikeyman_01
ID: 40592160
I did that.. Says its Up to Date
0
 

Author Comment

by:Mikeyman_01
ID: 40592420
It also looks like the bottom Records and info is all mixed up as well
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 40592431
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

Featured Post

Ready to get started with anonymous questions?

It's easy! Check out this step-by-step guide for asking an anonymous question on Experts Exchange.

Question has a verified solution.

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

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…
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

628 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