cancel
Showing results for 
Search instead for 
Did you mean: 

Number not adding up

Former Member
0 Kudos

HI all, I am creating a report with a sub report.

The sub report will pass a value to the same report detail. At the end, I will want to Sum up the value. I have issue adding up the value as I Share the value from the sub report.

Can anyone advise what is the work around?

In my report, I have a group which is "Category". I need to have the sub total of Category and grand total.

My share value in the main report named as "ShareAmt".

My report looking something like this .

I am unable to get the Total amount of 300 and 600 and grand total of 900.

Tried to created another sub report, the sub total for dinner only show 200and the sub total for lunch always show 100 only.

Noticed for total it always only show the last invoice amount.

Please advise.

Thanks!

Accepted Solutions (0)

Answers (3)

Answers (3)

abhilash_kumar
Active Contributor

Hi Mavis,

Assuming "ShareAmt" is the variable that shows the "Amount", here's what you need to do:

1. Modify the ShareAmt formula like so:

shared numbervar amt; //Replace this variable with the shared variable that shows Amount
shared numbervar stot := stot + amt;
amt; //Replace this variable with the shared variable that shows Amount

2. Create a separate formula and place this on Group Footer:

shared numbervar stot;
shared numbervar gtot;
gtot := gtot + stot;
stot;

3. Create a reset formula and place this on the Group Header:

shared numbervar stot := 0;

4. One last formula to show the Grand Total. Place this on the Report Footer:

shared numbervar gtot;

-Abhilash

0 Kudos

Thank you very much for this answer. Very helpful in better understanding the use of shared summary formulas and the placement for function. - Darek

Former Member
0 Kudos

HI,

Anyone can advise on the above. I tried the way Kevin advised but still having the same issue.

Thanks!

Former Member
0 Kudos

Hi Mavis,

This is likely to be due to the way Crystal Reports processes objects or better said CR processes some objects before others, so some things get ignored.

Just to clarify: So you are passing a value from the sub-report back to the main report in the same section, correct? Now you want to sum the values in the main report, including the value that you are retrieving from the sub-report?

What section is the sub-report in? Which section do you want the total and grand totals to be in?

Thanks,
Kevin

Former Member
0 Kudos

Hi Kevin,

Thanks for your prompted response.

From Sub report I pass the value to the main report detail session. I sub report I place it at Da and my value I place it in Db.

I will need to sum the value in Group 1 and RF.

Former Member
0 Kudos

Hi Mavis,

It is hard to say without seeing your report. However, I think that you may need to create a manual running total. Basically, a manual running total consist of 3 formulas, a reset, accumulate and display formulas, and the formulas will looks like:

    • Reset formula: ( Added to the Report Header, or Group Header section )

      WhilePrintingRecords;
      NumberVar myVariable := 0; // Set, or reset the value to zero.
      • Accumulate or Evaluate formula: ( Generally added to the Details section, but could be other sections depending on the requirement )

        WhilePrintingRecords;
        NumberVar myVariable := myVariable + 1
        • Display formula: ( Added to the Group Footer, or Report Footer section )

          WhilePrintingRecords;
          NumberVar myVariable

        You can find more about running totals in the CR help. Press F1 in the CR designer and the help will come up.


        Thanks,
        Kevin

        Former Member
        0 Kudos

        Hi Kevin,

        That is what I did but the total value will always remind as the value of the last Invoice value.

        I place the sharevalue in both GF1 and PF all getting from the last invoice value.

        Thanks.