cancel
Showing results for 
Search instead for 
Did you mean: 

Calculation on Totals from subreports

Former Member
0 Kudos

Hi

This is my first question on any forum so please be kind. I am using crystal XI and have two totals on my main report that have come from declared shared variables in two subreports. I have created a formula to add these totals to get a 'grand total'. The result is this field shows '0' on my main report. I have basically taught myself how to declare the shared variables, and the two figures I am after show on the main report, so I am assuming the shared variables are OK. I have a nasty feeling that I am placing the formula on my main report in the wrong place, (I have put it everywhere I can think of).Or the formula is incorrect.

Any help would be greatly appreciated, and save my sanity!!

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Make sure that the shared variable which you are calling in the main report should be in the below section of the sub report. If you want to pass the sub report to the main report in the same section then insert section below the sub report

You can pull sub report information and use in main report, while getting the data from sub report to main please take care of the following :

--Your sub report should be placed above your calculations in main report. ie. after processing of your sub report only you get data into your main report.

--While writing formulas in sub report or in main report you will have to use Whileprintingrecords; to get get data into your shared variables. Eg:

Whileprintingrecords;

shared numbervar x;

x:=x+fieldvalue;

--When you create a formula in sub report it should be placed on your sub report, use the same variable name while creating a formula in main report.

Regards,

Shweta

Former Member
0 Kudos

Hi Shweta

I have placed my formula in, what I believe to be, every conceivable place in my main report, to no avail. I think the problem is the formula

whileprintingrecords;

shared numbervar totalparts;

shared numbervar totalab;

(totalab)+(totalparts)

Thanks

Former Member
0 Kudos

Can you also paste the formulas that exist in subreports? I think it should work if you placed the formula after the sections where you placed the subreports.

for example

in sub report 1

whileprintingrecords;

shared numbervar totalparts;

totalparts:=sum();

in sub report 2

whileprintingrecords;

shared numbervar totalab;

totalab:=sum();

in main report try to place the following formula in report footer and see the results

whileprintingrecords;

shared numbervar totalparts;

shared numbervar totalab;

(totalab)+(totalparts)

Regards,

Raghavendra

Answers (1)

Answers (1)

Former Member
0 Kudos

Have got totals. Thanks very much.