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

Comparing Dates in Crystal IX 1

Status
Not open for further replies.

jenkoller

Programmer
Feb 11, 2005
14
US
I am trying to compare two dates. My overall question is to determine if the date of procedure Type TTE preceeded a TEE procedure type.

Patient A
TTE 12/8/2005
TEE 12/13/2005
TTE preceeded TEE: YES

The fields are:
Patient.ID
USAllProcedures.TestType UDRStudy.StudyDateTime
(The report is grouped by Patient.ID)

Any help would be appreciated.


 
Create three formulas:

//{@both}:
if {USAllProcedures.TestType} = "TTE" then 1 else
if USAllProcedures.TestType} = "TEE" then 1000 else 0

//{@TTEdate}:
if {USAllProcedures.TestType} = "TTE" then {UDRStudy.StudyDateTime}

//{@TEEdate}:
if {USAllProcedures.TestType} = "TEE" then {UDRStudy.StudyDateTime}

Then create a formula for the group header:
if sum({@both},{table.patientID}) >= 1001 and
remainder(sum({@both},{table.patientID}),1000) <> 0 and
minimum({@TTEdate},{table.patientID}) <
maximum({@TEEdate},{table.patientID}) then "Yes" else "No"

This will test for the presence of both testtypes and that the date of at least one test type TTE is earlier than the at least one of the test type TEE.

If you want to only return those patients where these condidtions are met, go to report->selection formula->GROUP and enter:

sum({@both},{table.patientID}) >= 1001 and
remainder(sum({@both},{table.patientID}),1000) <> 0 and
minimum({@TTEdate},{table.patientID}) <
maximum({@TEEdate},{table.patientID})

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top