Crystal XI
I’m writing a report that includes a field that calculates the difference between two dates. My data contains multiple rows of data related to the same patient encounter with different Charge Entry Dates, I want to pull only data with a certain batch name, then apply the earliest Charge Entry date to all lines. A sample of my data is as follows.
Ticket Number Type BatchName CPT DOS Charge Entry Date
ASH001344 Office Visit EMR ASH BLUM 112310 90471 11/19/2010 11/25/2010
ASH001344 Office Visit EMR ASH BLUM 112310 90472 11/19/2010 11/23/2010
ASH001344 Office Visit EMR ASH BLUM 112310 90658 11/19/2010 11/27/2010
ASH001344 Office Visit EMR ASH BLUM 112310 90715 11/19/2010 11/23/2010
ASH001344 Office Visit EMR ASH BLUM 112310 99204 11/19/2010 11/23/2010
ASH001344 Office Visit jsmith_20101119(1605774075000010) 99214 11/19/2010 11/19/2010
My Record selection formula is:
{Batch.Name} like "EMR*"
And my report results are:
Ticket Number Type BatchName CPT DOS Charge Entry Date
ASH001344 Office Visit EMR ASH BLUM 112310 90471 11/19/2010 11/25/2010
ASH001344 Office Visit EMR ASH BLUM 112310 90472 11/19/2010 11/23/2010
ASH001344 Office Visit EMR ASH BLUM 112310 90658 11/19/2010 11/27/2010
ASH001344 Office Visit EMR ASH BLUM 112310 90715 11/19/2010 11/23/2010
ASH001344 Office Visit EMR ASH BLUM 112310 99204 11/19/2010 11/23/2010
I’ve then used the following SQL expression called “EarliestDOE” to select the earliest date and move it into the detail of my report:
(select min("PatientVisitProcs"."DateOfEntry")
from PatientVisitProcs
Where "PatientVisitProcs"."PatientVisitId"="PatientVisit"."PatientVisitId")
However my report results are:
Ticket Number Type BatchName CPT DOS Charge Entry Date EarliestDOE
ASH001344 Office Visit EMR ASH BLUM 112310 90471 11/19/2010 11/25/2010 11/19/2010
ASH001344 Office Visit EMR ASH BLUM 112310 90472 11/19/2010 11/23/2010 11/19/2010
ASH001344 Office Visit EMR ASH BLUM 112310 90658 11/19/2010 11/27/2010 11/19/2010
ASH001344 Office Visit EMR ASH BLUM 112310 90715 11/19/2010 11/23/2010 11/19/2010
ASH001344 Office Visit EMR ASH BLUM 112310 99204 11/19/2010 11/23/2010 11/19/2010
The SQL Expression is pulling the date from the batch that did not meet my record selection criteria. How can I get the report to pull the earliest date from only the batches selected by the Record Selection formula.
Thank you
I’m writing a report that includes a field that calculates the difference between two dates. My data contains multiple rows of data related to the same patient encounter with different Charge Entry Dates, I want to pull only data with a certain batch name, then apply the earliest Charge Entry date to all lines. A sample of my data is as follows.
Ticket Number Type BatchName CPT DOS Charge Entry Date
ASH001344 Office Visit EMR ASH BLUM 112310 90471 11/19/2010 11/25/2010
ASH001344 Office Visit EMR ASH BLUM 112310 90472 11/19/2010 11/23/2010
ASH001344 Office Visit EMR ASH BLUM 112310 90658 11/19/2010 11/27/2010
ASH001344 Office Visit EMR ASH BLUM 112310 90715 11/19/2010 11/23/2010
ASH001344 Office Visit EMR ASH BLUM 112310 99204 11/19/2010 11/23/2010
ASH001344 Office Visit jsmith_20101119(1605774075000010) 99214 11/19/2010 11/19/2010
My Record selection formula is:
{Batch.Name} like "EMR*"
And my report results are:
Ticket Number Type BatchName CPT DOS Charge Entry Date
ASH001344 Office Visit EMR ASH BLUM 112310 90471 11/19/2010 11/25/2010
ASH001344 Office Visit EMR ASH BLUM 112310 90472 11/19/2010 11/23/2010
ASH001344 Office Visit EMR ASH BLUM 112310 90658 11/19/2010 11/27/2010
ASH001344 Office Visit EMR ASH BLUM 112310 90715 11/19/2010 11/23/2010
ASH001344 Office Visit EMR ASH BLUM 112310 99204 11/19/2010 11/23/2010
I’ve then used the following SQL expression called “EarliestDOE” to select the earliest date and move it into the detail of my report:
(select min("PatientVisitProcs"."DateOfEntry")
from PatientVisitProcs
Where "PatientVisitProcs"."PatientVisitId"="PatientVisit"."PatientVisitId")
However my report results are:
Ticket Number Type BatchName CPT DOS Charge Entry Date EarliestDOE
ASH001344 Office Visit EMR ASH BLUM 112310 90471 11/19/2010 11/25/2010 11/19/2010
ASH001344 Office Visit EMR ASH BLUM 112310 90472 11/19/2010 11/23/2010 11/19/2010
ASH001344 Office Visit EMR ASH BLUM 112310 90658 11/19/2010 11/27/2010 11/19/2010
ASH001344 Office Visit EMR ASH BLUM 112310 90715 11/19/2010 11/23/2010 11/19/2010
ASH001344 Office Visit EMR ASH BLUM 112310 99204 11/19/2010 11/23/2010 11/19/2010
The SQL Expression is pulling the date from the batch that did not meet my record selection criteria. How can I get the report to pull the earliest date from only the batches selected by the Record Selection formula.
Thank you