Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SUBTRACT SUBREPORTS

Status
Not open for further replies.

Elango1253

Programmer
May 16, 2007
8
0
0
IN
Hi all,
I'm using CR10..I hav 3 subreports.Each subreports have same column name & same Row.
I want to display the Subtraction of
Subreport1 column name1 - Subreport2 ColumnName1
into Subreport3 ColumnName1..
Anyone who knows the solution for this problem plz let me know..

Thanks in Advance.

ELANGO.P
 
You need to pass the subreport values to the main report in a shared variable:

WhilePrintingRecords;
Shared Numbervar MySubTot1:=sum({MyField})

Do something similar with the other 2 subreports.

Then in the main report, add them up:

WhilePrintingRecords;
numbervar MyTotal:=MySubTot1+MySubTot2+MySubTot3

numbervar MyTotal;

Software Sales, Training, Implementation and Support for Macola, eSynergy, and Crystal Reports

"If you have a big enough dictionary, just about everything is a word"
--Dave Barry
 
Dear Dave Barry,
I need not sum of SubReports..Actually I didn't use Main Reports..All three are Subreports only..For Eg.,

SubReport1
..........
Payor CurrentMonth
..... .............
Elango 23000
Davis 43280
Prasanna 45000


SubReport2

Payor CurrentMonth
...... ...............
Elango 12000
Davis 23280
Prasanna 13000

The Result Should Be Like This..
SubReport3

Payor currentMonth
...... ...............
Elango 11000 /* (23000 - 12000)*/
Davis 20000 /* (43280 - 23280)*/
Prasanna 32000 /* (45000 - 13000)*/

what is the solution for this Output..Plz give me the Soln..

ELANGO.P
 
Elango1253, shared variables are the only way to share results from a subreport. This should include sharing it between subreports.

If you've got a lot of names, then I don't think that will work, you might manage it with an array.

Also re-consider your design. Crystal won't allow subreports from subreports, but could you moved one of them up to be the main report? And then do the other two as subreports at detail level?

Or is there a way to link the data in a single report rather than three subreports?

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
I agree with Madawc to some extent, lose the subreports.

You post nothign technical, and dictate design. Are you certain that this is the best approach? Noody here could provide another means to do this?

As opposed to stating the software version and database, showing data and the expected output and requesting a solution?

I would guess that a MINUS Query would serve you better, pushing this back to the database in a command object, but I've spent more time on this than I should based on your approach to requirements sharing.

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top