# Use retured vars from subreports in running totals?

I have a var from my subreport and it's value is correct.

I need to Sum that var in group by totals as well as End of report.

I can't seem to find out how to make a running total on that VAR or sum it.

This is a Warranty claims report.  Sub report has the pieces details and extended costs + labor.  Main report covers all the "reasons" for the claim.

I need to carry the total from this claim to the group by total line.  I can't seem to find out how?

This is Crystal for .NET

TIA

__Stephen
LVL 1
###### Who is Participating?

Commented:
PatKirsch {13778912}
0

Commented:
You can use shared variables.

In the main report header create a formula
Name - DeclVars
Formula
shared numbervar SubValue;

Name - SetVars
Formula
whileprintingrecords;
shared numbervar SubValue;
SubValue := {Field or Calculation};

You may then have to add another formula to do the totals rather than using summary or a running total.

mlmcc

0

Commented:
0

Author Commented:
Thanks for the link to what I used to push/pull the data to the main report.

I have the var @ClaimTotal captured in the main report already.  I see a value of 195.67 for this claim.

Now how do I create a running total on @CalimTotal so my group footers can say that for this model type my total claims are 1356.98?

Also need to see a total of all calims across model types at the end of the report.

0

Commented:
Probably through a formula like

whileprintingrecords;
shared numbervar SubValue;
{@ClaimTotal} + SubValue

Have to think about the grand total

mlmcc
0

Commented:
just a bit of further clarification (since it actually sounds like you want both group subtotals plus report grand totals? - this would actually call for 2 sets of running totals (and because you're using a shared variable, you won't be able to use the running total expert, so mlmmc's suggestions are dead on... only clarification owuld be for the "reset" formulas to add to get 1) the correct group subtotals and 2) a precaution to insure correct values upon report "refresh"  - i.e. often each running total requires 3 formulas:

1) to set the variable to zero
2) to compute the value (the formulas outlined above)
3) optional = to display the result (if you just want a single value visible vs. the actual running total accumulator details

so the additional formulas would be:
#1 = zero reset formulas:
for the grand total                          for the group total
zero reset formula         whileprintingrecords;                         whileprintingrecords;
variable declaration info/name-01;       variable declaration info/name-02;
name-01 := 0                                     if inrepeatedgroupheader = true then name-02 := name -02
else name-02 := 0

#2 formulas = similar to the above... just be sure to use 2 different vairiable names so that each will accumulate separately

#3 = display formulas:
place in                        report footer                                     group footer
display formula             whileprintingrecords;                         whileprintingrecords;
variable declaration info/name-01;       variable declaration info/name-02;
name-01 := name-01                          name-02 := name-02

0

Commented:
srussell705 -  How is that the answer to this question?

mlmcc
0

Commented:
yes, I'm confused also...
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.