Print Page | Close Window

Clearing Subreport Totals

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=20425
Printed Date: 02 May 2024 at 3:13am


Topic: Clearing Subreport Totals
Posted By: DianeColvin
Subject: Clearing Subreport Totals
Date Posted: 04 Feb 2014 at 11:53am
I am fairly new to Crystal Reports.  I have a subreport with a link (whse id) from the main report.  In the subreport I have total fields that I pass back out to the main report.  My problem is, if there is no link (no information for the given whse id in the table in my subreport), it retains the value from the last total fields printed (from previous whse id).  How do I clear the total fields after I print them so the values don't show up for the next whse which should have 0.

Thank you,



Replies:
Posted By: DianeColvin
Date Posted: 04 Feb 2014 at 11:54am
Forgot to mention:  Subreport runs at Detail time, Totals print at Group Footer #2.


Posted By: kevlray
Date Posted: 05 Feb 2014 at 6:29am
I would suggest putting a formula in the GH#2 that initializes the shared variable to zero.


Posted By: DianeColvin
Date Posted: 05 Feb 2014 at 7:18am
Yes.  But if I have 5 fields call them a, b, c, d, e, what would the formula look like?  I want all to be set to 0 at GH2




Posted By: kevlray
Date Posted: 05 Feb 2014 at 11:57am
if you have 5 shared variables that need to be cleared.  Then the formula would looks something like this (assuming the shared variables are numbers)
shared numbervar a :=0;
shared numbervar b :=0;
shared numbervar c :=0;
shared numbervar d :=0;
shared numbervar e :=0;


Posted By: DianeColvin
Date Posted: 05 Feb 2014 at 2:15pm
Thank you Smile



Print Page | Close Window