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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Accessing data outside selection criteria 1

Status
Not open for further replies.

crachic

Technical User
Dec 27, 2007
46
US
I am using Crystal XI

Here is what I am trying to accomplish in words.

For all Inpatient episodes, find all charges for a patient that are within 3 days of the admit date of the inpatient episode.

At this point I am not worried about the layout but I have a small sampling of data that I am working with.

For example:
Episode 11 - Inpatient Episode - Admit Date - 4/19/08
Charge of $100
Episode 10 - Outpatient Episode - Admit Date - 4/17/08
Charge of $500
Charge of $1000
Episode 9 - Outpatient Episode - Admit Date - 4/17/08
Charge of $300
Episode 8 - Outpatient Episode - Admit Date - 4/15/08
Charge of $400

I would expect the output to show that charges from episodes 11, 10, 9 but not show the charges from episode 8 because it is more than 3 days outside the admit date of the inpatient episode.

I was thinking I could use conditional suppressing somehow but am not sure how I would use it.

Any thoughts.

-crachic
 
If data is not needed, it is better to avoid selecting it. Something like
Code:
DateDiff ("d", {date1},  currentdate) <= 3
Put this in record selection and it should do the job.

For section suppression, right-click on the section and choose Format Section. Then choose the formula icon (x+2 and a pencil) for suppression. Enter a test there.


[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
Because there might be more than one inpatient episode per client, you might want to use a subreport. Group the main report by client and then by episode, and limit the records in the main report to inpatient episodes. Then link the main report to the sub on client # and episode date. Then in the subreport, go into the record selection formula and change it to:

{episode.date} >= dateadd("d",-2,{?pm-episode.date}) and
{episode.date} < dateadd("d", 3, {?pm-episode.date})

Then show the amounts and the total in the subreport. The only issue that might arise is if there are inpatient episodes within a few days of each so that some charges appear as related to multiple inpatient episodes. I don't know how likely that is.

If you need to show charges across customers, you would have to use shared variables to bring the sub results back into the main report for calculations.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top