Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Report Selector using 2 lines from the same table Post Reply Post New Topic
Author Message
Rockytop
Newbie
Newbie
Avatar

Joined: 20 Jun 2011
Location: United States
Online Status: Offline
Posts: 5
Quote Rockytop Replybullet Topic: Report Selector using 2 lines from the same table
     Posted: 20 Jun 2011 at 9:30am
Hi all. I'm relatively new to CR (using CR XI) and am trying to write a report that selects records based on criteria from multiple lines of the same table.. Specifically, the following from an Oracle database:
 
Show all patients (PERSON.SEARCHNAME) where the medication list contains a medicine having a GPI code (MEDICATE.GPI) starting with A,B, OR C,   AND any other medication in that same table having a GPI code that starts with X, Y, OR Z.
 
Any help appreciated... Hope I was specific enough in what I am trying to accomplish.
IP IP Logged
Ian Gelderblom
Newbie
Newbie


Joined: 10 Jan 2011
Online Status: Offline
Posts: 11
Quote Ian Gelderblom Replybullet Posted: 20 Jun 2011 at 10:29am
Sup Rocky,

I'm not sure if i understand you correctly but try the following:

Let your report show all the patients.
Then Make a formula field with the following formula:
Basic Syntax

Dim cSuppress as String

cSuppress = Mid ({MEDICATE.GPI},1,1)
formula = cSuppress

Suppress your details section with the following query:

If {FormulaField} <> "A" or {FormulaField} <> "B" or {FormulaField}<> "C"

Edited by Ian Gelderblom - 20 Jun 2011 at 10:30am
IP IP Logged
Rockytop
Newbie
Newbie
Avatar

Joined: 20 Jun 2011
Location: United States
Online Status: Offline
Posts: 5
Quote Rockytop Replybullet Posted: 20 Jun 2011 at 11:08am
That would seem to work if I JUST wanted find patients who are on Medication 1... How do I combine it to show the combination?... ie.. we've got the A,B, or C.. Now how about the X,Y, or Z from Medication 2?
IP IP Logged
Ian Gelderblom
Newbie
Newbie


Joined: 10 Jan 2011
Online Status: Offline
Posts: 11
Quote Ian Gelderblom Replybullet Posted: 21 Jun 2011 at 7:19am
Can you provide me with more detail regarding your table structure?
IP IP Logged
Rockytop
Newbie
Newbie
Avatar

Joined: 20 Jun 2011
Location: United States
Online Status: Offline
Posts: 5
Quote Rockytop Replybullet Posted: 21 Jun 2011 at 8:20am
The PERSON table and MEDICATE table are linked with the field PID in both tables. Not sure what else you might need. Please let me know if there's other detail you require. Thanks.
IP IP Logged
Rockytop
Newbie
Newbie
Avatar

Joined: 20 Jun 2011
Location: United States
Online Status: Offline
Posts: 5
Quote Rockytop Replybullet Posted: 21 Jun 2011 at 9:55am
I'm trying to "Record Select" based on the combined "filters" of the MEDICATE.GPI field of multiple rows (records) in the same table.
IP IP Logged
Rockytop
Newbie
Newbie
Avatar

Joined: 20 Jun 2011
Location: United States
Online Status: Offline
Posts: 5
Quote Rockytop Replybullet Posted: 21 Jun 2011 at 3:55pm
Thanks. I have the solution now... Needed to bring in a second medicate table.
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