Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Syntax Needed 1

Status
Not open for further replies.

JMB7

MIS
May 19, 2004
26
US
Crystal 8.5

I need to write report that returns patients that have multiple qualifications of the same field. Example: Need patients who have had hosp_svc equal to 'SRC' and 'SDS' and 'GNC' over the past year.
I have tried the following-
hosp_svc in ('SRC','SDS','GNC')

hosp_svc in SRC and
hosp_svc in SDS and ....

but it is not giving me the expected results.
Thanking you in advance for any help
 
hosp_svc in ['SRC','SDS','GNC']

OR

hosp_svc in ("SRC","SDS","GNC"]

 
Typo on the 2nd one. Should be

hosp_svc in ["SRC","SDS","GNC"]
 
Thank you for your responce. I tried your syntax, but it is still returning patients with any combination of the three. I need all three.
 
Do you have a table which has a record for each combination of patient and hosp_svc?
 
The table has one record for each occurence, they are not combined.
 
OK, try this:

in the details section of the report have patient ID (or equivalent) and hosp_svc.
Create a formula which is 1 if "hosp_svc in ('SRC','SDS','GNC')" else zero.
Put that on the details line too.
Add a group - by Patient ID.
Add a summary - count of the formula field and put that in the group header.
Add a selection criteria - where the summary = 3.
Suppress the details section and anything else you don't want to see.
Does this work?
 
I am trying your suggestion, just running into problems where some patients might have 4 SDS, then 1 SRC and 1GNC. I will let you know - thank you for your help.
 
Group on patient ID and then create a formula for each value to be placed in the detail section:

//{@SDS}:
if {table.hosp_svc} = "SDS" then 1 else 0

//{@SRC}:
if {table.hosp_svc} = "SRC" then 1 else 0

//{@GNC}:
if {table.hosp_svc} = "GNC" then 1 else 0

Then go to report->edit selection formula->GROUP and enter:

sum({@SDS},{table.patientID}) > 0 and
sum({@SRC},{table.patientID}) > 0 and
sum({@GNC},{table.patientID}) > 0

-LB
 
Thank you so much for your help. It worked beautifully!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top