Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: only display records where all child records equal Post Reply Post New Topic
Author Message
nbritton
Newbie
Newbie
Avatar

Joined: 30 Sep 2009
Online Status: Offline
Posts: 25
Quote nbritton Replybullet Topic: only display records where all child records equal
     Posted: 13 Oct 2009 at 8:00am
Is there a way to only select records where all child records of a related table equal a specific value.

Example: I have two tables incident and tasks. Each incident may have many tasks. incident is related to task by incident.recid to task.parent_recid.

I want to select all records where incident.status = active and where all child records where tasks.status = completed.

When i use the select expert i am getting results where one of the tasks is completed but all are not. I only want to display active incidents where all tasks have been completed.

Does anyone have any ideas?
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 14 Oct 2009 at 7:02am
I take it there is no status on the incident to say completed.  If not, there isn't a join that is going to work as you want.  Without getting the data via a view or a strored proc, the best you can do is leave the current filter in place, then group by incident.  Create a subreport that checks if all tasks are completed and returns a value via a shared variable.  you can run the subreport in GHa and if not all tasks are completed suppress GHb and Details.
 
At least that is the plan of attack that I would use.  I know it touches on alot of ideas/techniques, but it is the best method that I can think of.
 
HTH
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