Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Return all if any are missing Post Reply Post New Topic
Author Message
meg76148
Newbie
Newbie


Joined: 28 Jul 2014
Location: United States
Online Status: Offline
Posts: 5
Quote meg76148 Replybullet Topic: Return all if any are missing
     Posted: 14 Oct 2014 at 3:51am
i have a bunch of clients with multiple cases, some of these clients have cases with missing file dates. i am trying to create a report in Crystal that will return each client that is active and all that clients cases if any one of those cases is missing the file date.


here is kinda what it should look like:

client table w/ client id, name, dob, address, phone....

cases table w/ case, description, file date.

CLIENT_ID   CLIENT      DOB        ADDR          PHONE
77        smith, jane 19910109 123 hill st.    34567891

CLIENT_ID        CASE      DESC             FILE_DATE
77                      1       bla bla          20140907
77                      2       bla bla          20140930

68        smith, joe   19990502 123 mall st. 1234569632
68                       1        bla bla          20140709
68                      2        bla bla          20140506
68                      3        bla bla          

21        smith, greg 19720101 123 fall st. 1234568521
21                      1        bla bla   
21                      2        bla bla


if any active client has active cases with missing file dates .....return that client and all their cases.

I'm using a main report that returns the clients if they are active and a sub-report that returns all the cases for that client. I linked the 2 reports with the client_id

In the example above i want to see all the cases for Joe Smith and Greg Smith because they have missing file dates but Jane Smith doesn't so I don't want her on the report at all. I just can't figure out how to write
that into my record selection criteria. [IMG]smileys/smiley19.gif" align="middle" />

Edited by meg76148 - 14 Oct 2014 at 3:55am
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 14 Oct 2014 at 3:59am
is there a reason you are using a sub report?
using the sub report limits your options.
if you can move the subreport as part of the main report you can use group select criteria
IP IP Logged
meg76148
Newbie
Newbie


Joined: 28 Jul 2014
Location: United States
Online Status: Offline
Posts: 5
Quote meg76148 Replybullet Posted: 14 Oct 2014 at 4:45am
I would prefer not to have a sub-report. So I just created a copy and moved everything to main report. I now have one group by Name and one group by Case (pulled in case_id). still can't figure out how to tell the case grouping to pull all the cases if any one of them is null??
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 14 Oct 2014 at 4:51am
create a formula to 'flag' the group
//NullFlag
if isnull(field) then 1 else 0
Sum this at the group level
now any group with a sum>0 has at least one missing record
use that as your group select criteria
SUM(NULLFLag,groupfield)>0
IP IP Logged
meg76148
Newbie
Newbie


Joined: 28 Jul 2014
Location: United States
Online Status: Offline
Posts: 5
Quote meg76148 Replybullet Posted: 14 Oct 2014 at 6:52am
Thank you!!! I had to think about it and group by another field but I got it to work and you are my hero!!!
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