Print Page | Close Window

Using a subreport total to do a calculation in the

Printed From: Crystal Reports Book
Category: Crystal Reports for Visual Studio 2005 and Newer
Forum Name: Writing Code
Forum Discription: .NET programming API, report integration
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=20193
Printed Date: 02 May 2024 at 2:14pm


Topic: Using a subreport total to do a calculation in the
Posted By: Martyb260
Subject: Using a subreport total to do a calculation in the
Date Posted: 05 Nov 2013 at 7:28am
I have a sub-report linked to my main report to pull an account balance.  I then need to use that sub-report account balance and subtract that from a figure in the main report.  How do I do that?



Replies:
Posted By: lockwelle
Date Posted: 10 Dec 2013 at 5:01am
I would assume you figured it out, but the answer would be shared variables, in the main before the call to the subreport you would have the reset:
shared numbervar x:=0;
"" //hides the reset

in the subreport, probably the report footer
shared numbervar x;
x:= however you calculated the balance
"" //again to hide the balance

in the main report, after the subreport
shared numbervar x;
//use x however needed in the main report

sorry this is late, I don't monitor this forum very often.

HTH


Posted By: Martyb260
Date Posted: 10 Dec 2013 at 5:15am
I will see if I can figure this out as the syntax you have used is not in Crysal Reporting format.  Thank you and I will see what I can do.


Posted By: lockwelle
Date Posted: 10 Dec 2013 at 5:21am
Actually, except for how you actually use the variable, it is CR syntax...native syntax, not Visual Basic.

All that I am showing is how to declare, set, and access a shared variable...since I have no idea of what the database/datatable structure is or how you need/plan to use the value.

HTH


Posted By: Martyb260
Date Posted: 10 Dec 2013 at 5:31am

I undersand.  Thank you for all of your assistance.  I will see how I can use your information to run the reports.




Print Page | Close Window