Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Value in mainform should be 0 when empty subreport Post Reply Post New Topic
Author Message
CharlieS
Newbie
Newbie


Joined: 01 May 2010
Location: Belgium
Online Status: Offline
Posts: 3
Quote CharlieS Replybullet Topic: Value in mainform should be 0 when empty subreport
     Posted: 02 May 2010 at 12:00am
In the mainreport, I have a field with a total coming from the subreport.  This works fine as long as the subreport is not empty.
 
When the subreport is empty, I get a duplicate value from the last "not empty" subreport.  I want to get '0'.
 
Do You know how I should handle this ?
 
Tx
Carl 


Edited by CharlieS - 02 May 2010 at 12:01am
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 03 May 2010 at 3:14am
I would try setting your shared variable to 0 before calling the subreport.
 
When there is no definite hierarchy in the report that would allow this, I will create another section, place it above the call, reset the variable, and suppress this new section.
 
HTH
IP IP Logged
CharlieS
Newbie
Newbie


Joined: 01 May 2010
Location: Belgium
Online Status: Offline
Posts: 3
Quote CharlieS Replybullet Posted: 03 May 2010 at 5:01am

Seems a good idea, but how to reset the calculated field [SRPT_TotalClocked] (formula:    WhilePrintingRecords;
Shared CurrencyVar SRPT_TotalClocked;
SRPT_TotalClocked)

Just placing the calculated field in the upper section is not enough, where or how should I reset it ?
 
(To young to be senior :)
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 03 May 2010 at 5:33am
In the upper section:

WhilePrintingRecords;
Shared CurrencyVar SRPT_TotalClocked := 0;

 HTH
 
IP IP Logged
CharlieS
Newbie
Newbie


Joined: 01 May 2010
Location: Belgium
Online Status: Offline
Posts: 3
Quote CharlieS Replybullet Posted: 03 May 2010 at 6:34am
I put the formula in a new calculated field and dropped it in the uppersection.
It's working fine now. Thumbs%20Up
 
Thanks
 
 
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum