Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Technical Questions
Message Icon Topic: Count Unsuppressed records Post Reply Post New Topic
Page  of 2 Next >>
Author Message
elamantia
Newbie
Newbie
Avatar

Joined: 20 Aug 2008
Online Status: Offline
Posts: 24
Quote elamantia Replybullet Topic: Count Unsuppressed records
    Posted: 02 Apr 2009 at 4:14pm
I have a report that I'm grouping under individual ID number.  I have suppressed all the records that have a 2 for a referral number, using the detail section expert with a formula.  I would like to get a count of who is left.  All I get is the total including the suppressed records.  I have tried the three formula method (with a few variations) using the following:
 
//Reset counter
WhilePrintingRecords;
NumberVar Participants := 0;
 
//Summary counter
WhilePrintingRecords;
NumberVar Participants;
Participants := Participants + 1;
 
//Display counter
WhilePrintingRecords;
NumberVar Participants;
Participants;
 
I will place the "reset" formula in the group header, the "summary" in the detail section and the "display" in the group footer.  I still get a count of all records! Cry
This seems like it should be easy!!  I'm using CR XI
minnie_eye
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 02 Apr 2009 at 5:27pm
You can use a running total as a count set to use the opposite formula of the condition that you are suppressing (referral #<>2) on and resetting it your group level.
IP IP Logged
elamantia
Newbie
Newbie
Avatar

Joined: 20 Aug 2008
Online Status: Offline
Posts: 24
Quote elamantia Replybullet Posted: 06 Apr 2009 at 8:00am
I neglected to say that I have also suppressed duplicate records. 
 
Your solution works nicely for referrals <> 2, but it's counting the other suppressed records. 
 
All suggestions are welcome!! 
Thanks for your time.
minnie_eye
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 06 Apr 2009 at 8:06am
How did you suppress those records? Using a previous statement?
Can't you just that add that criteria in the running total formula?
SOmething like:
referral #<>2 or previous (field) <> field
IP IP Logged
elamantia
Newbie
Newbie
Avatar

Joined: 20 Aug 2008
Online Status: Offline
Posts: 24
Quote elamantia Replybullet Posted: 06 Apr 2009 at 8:28am
My report shows an individual ID # and a referral type.  In the Detail Section Expert I used the following statement to suppress certain records:
{JRF_TBLREFERRAL.REFERRALTYPEID} = 2 or
{@All} = Next ({@All})
 
The formula for 'All' is: {JRF_TBLREFERRAL.INDIVIDUALID} & {JRF_TBLREFERRAL.REFERRALTYPEID}
 
The running total count is 4,177. 
 
If I change the Running Total Condition Formula to:
{JRF_TBLREFERRAL.REFERRALTYPEID} <> 2 or
{@All} <> Next ({@All}) then the total count changes to 9,125.
 
The total should be around 3100.
minnie_eye
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 06 Apr 2009 at 9:00am
Try a running total as a DistinctCount on the {@All} field using the formula of
{JRF_TBLREFERRAL.REFERRALTYPEID} <> 2
IP IP Logged
elamantia
Newbie
Newbie
Avatar

Joined: 20 Aug 2008
Online Status: Offline
Posts: 24
Quote elamantia Replybullet Posted: 06 Apr 2009 at 12:10pm
That did it!!  Just one more thing..    Smile
It is not counting the records that have a null referral type.
Thanks again!
minnie_eye
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 06 Apr 2009 at 12:51pm
They are probably omitted from your formula All results, because the {JRF_TBLREFERRAL.REFERRALTYPEID} is the null item correct?
If so try  changing your formula to handle these as:
{JRF_TBLREFERRAL.INDIVIDUALID} & (if isnull({JRF_TBLREFERRAL.REFERRALTYPEID}) then "NULL" else {JRF_TBLREFERRAL.REFERRALTYPEID})
This will insert a dummy value of the word "NULL" whenever that field is null and should include them in the count.
If this wasn't the issue can you give me a bit more of a description.
Thanks.
IP IP Logged
elamantia
Newbie
Newbie
Avatar

Joined: 20 Aug 2008
Online Status: Offline
Posts: 24
Quote elamantia Replybullet Posted: 06 Apr 2009 at 1:16pm
Yes that is the issue.  The {JRF_TBLREFERRAL.REFERRALTYPEID} on some of the records is null.  When I tried the new formual I received "a string is required here" error for {JRF_TBLREFERRAL.REFERRALTYPEID} after the else. 
minnie_eye
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 06 Apr 2009 at 1:22pm
if these are numeric fields you can either insert a zero instead of the null or convert the whole thing to text (don't use a zero if that is a valid response for that IDfield).
I also personally would add a "dash" to know where the two items meet like below. This also assumes the individualid is numeric and needs to be altered to text:
totext({JRF_TBLREFERRAL.INDIVIDUALID},0,"") + "-" + (if isnull({JRF_TBLREFERRAL.REFERRALTYPEID}) then "NULL" else totext({JRF_TBLREFERRAL.REFERRALTYPEID}),0,"")


Edited by DBlank - 06 Apr 2009 at 1:22pm
IP IP Logged
Page  of 2 Next >>
Post Reply Post New Topic
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



This page was generated in 0.027 seconds.