Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Display Filter Query Post Reply Post New Topic
Author Message
bluepork
Newbie
Newbie


Joined: 14 Sep 2011
Online Status: Offline
Posts: 2
Quote bluepork Replybullet Topic: Display Filter Query
     Posted: 14 Sep 2011 at 3:27am
I am trying to construct a report that includes a {surname}, {client number}, {referral number} and {referral end date}.
 
Some referrals do not have end dates and there may be multiple referral numbers per client. Without any filtering applied each referral number is displayed on distinct lines.
 
I wish to filter the results with the following criteria - exclude all clients and referrals when all referral end dates occur before 01/04/09. In other words some clients may have referrals that ended prior to 01/04/09 but these referral entries need to be displayed because there are other unended or were ended after 01/04/09 for the client.
 
I hope this makes sense and any advice would be gratefully received.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 14 Sep 2011 at 3:56am
NOT(isnull(table.referraldate))
or
table.referraldate<date(2009,1,4)
IP IP Logged
bluepork
Newbie
Newbie


Joined: 14 Sep 2011
Online Status: Offline
Posts: 2
Quote bluepork Replybullet Posted: 14 Sep 2011 at 4:14am
Thank you but unfortunately I don't think it'll be that simple. I've displayed a sample of results I've manually edited in excel to present what I wish to end up with (in the table on the right).
 
It includes all referrals for client no = 30959 because they had a referral end date after 01/04/09. It has excluded client no = 12487 because all referrals ended prior to 01/04/09.
 
Client No Referral No Ref End Date   Client No Referral No Ref End Date
481 1059624  13-08-09   481 1059624  13-08-09
6710 1065959  17-11-10   6710 1065959  17-11-10
6710 69779     6710 69779  
12487 69850  26-03-02   30959 1057955  17-06-09
12487 69847  14-07-93   30959 1007289  23-07-07
12487 69848  31-01-95   30959 1039936  
12487 69849  06-03-95   30959 1039931  
25462 71417  10-02-03   30959 73676  
25462 71408  05-03-02   30959 1019449  25-07-07
27116 71666  16-07-01   30959 1034669  07-03-08
27116 71665  21-03-94        
27116 71664  01-02-93        
29223 72457  28-10-99        
30867 73605  24-10-97        
30959 1057955  17-06-09        
30959 1007289  23-07-07        
30959 1039936          
30959 1039931          
30959 73676          
30959 1019449  25-07-07        
30959 1034669  07-03-08        
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 14 Sep 2011 at 4:23am
ah, i read your original post to exclude all records that were < your date.
You are asking to exclude all clients where all records are < your date and show all clients and all of there records if any one record has a date > your cut off date. if so here is one way...
 
group on client
create a "flag" formula to count your cut off records
if isnull(table.referraldate) or table.referraldate>=date(2009,1,4) then 1
sum this at your group level
any group tht has a record meeting your show criteria now has a value >0
insert a count of the records at the group level
use this information inthe selct expert Group selection to get your 2 criteria
count(table.field,table.clientno)<>sum(flag,table.clientno) and sum(flag,table.clientno) >0
 
 
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