Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Return "True" if Any Records in set Meet Criteria Post Reply Post New Topic
Author Message
dpanders
Newbie
Newbie


Joined: 28 Apr 2011
Online Status: Offline
Posts: 8
Quote dpanders Replybullet Topic: Return "True" if Any Records in set Meet Criteria
     Posted: 12 Jul 2013 at 4:41am

I have a report that I am trying to do 2 things with.

I want to look at a set of records and if any of the records meet my criteria, I want to return a "True" string ("EHR" in this case). I am running into 2 problems.

When I use a formula in the main report I run into a problem with unintentionally limiting the overall output to just those records that have an entry in another table (PHY_ADVISOR):

IF ISNULL ({PHY_ADVISOR_AH.CONTACT_ID}) THEN "" ELSE
    IF {PHY_ADVISOR_AH.ADVISOR} in ["EHR"] THEN "EHR" ELSE ""
 
So, my solution is to put this in a subreport which works fine...sort of.
 
The subreport is causing the overall report to run very slowly. Also, when it returns the value, it brings all values where the condition is met. I want it to only return one True (i.e. "EHR") if ANY of the records contain that string. I have already tried "=" instead of the "in" statements with no change in outcomes.
 
So, my two questions are:
1. How do I return only 1 True statement regardless of how many records contain the target string?
2. How do I move this out of a subreport and into the main report without limiting the overall record sets to just those records with a Physician Advisor record?
 
Thanks.


Edited by dpanders - 12 Jul 2013 at 4:42am
Darren P. Anderson, MSN, RN

Manager, Utilization Management
Vidant Medical Center
2100 Stantonsburg Road
Greenville, NC 27834

Phone (252) 847-2402
IP IP Logged
dpanders
Newbie
Newbie


Joined: 28 Apr 2011
Online Status: Offline
Posts: 8
Quote dpanders Replybullet Posted: 12 Jul 2013 at 4:48am
Sorry about the paragraphs running together. I can't seem to fix them.
Darren P. Anderson, MSN, RN

Manager, Utilization Management
Vidant Medical Center
2100 Stantonsburg Road
Greenville, NC 27834

Phone (252) 847-2402
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 12 Jul 2013 at 12:04pm
Try this:
1.  Get rid of the subreport.
2.  Add the PH_ADVISOR_AH table back in to the main report. 
3.  Link FROM the other table in the report TO this table.
4.  Right-click on the link and select "Link Options...".
5.  Change the link to a "Left Outer Join".
 
The resulting query will give you all of the records in the original table, regardless of whether there is a matching table in the PHY_ADVISOR_AH table.
 
-Dell
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