basic structure of the report-
records are selected by discharge date, so we are selecting patients that are discharged within a given date range. In this case, Jan 2006.
patient records are grouped by patient id ("patid"), so all records that are selected are contained in that group.
each patient has a number of commital_status_values (yep- its a mental institution), and an effective_date that corresponds with it. What the facility needs is the last commital_status_value- i.e. the one that was active at the time of the patients discharge. So, I suppressed the unwanted records with this suppression formula:
IF {#RTotal0} = {COMMITMENT.EFFECTIVE_DATE} THEN FALSE ELSE TRUE
Also, #Rtotal0 is comprised of the following:
Maximum of COMMITMENT.EFFECTIVE_DATE
Evaluate: for each record
Reset: On change of group PATIENT_DATA.PATID
Now, this works for suppressing the fields I need. But, I use the following to try and count a specific committal_status_value, with a maximum effective_date, and the result is always 0:
IF {#RTotal0} = {COMMITMENT.EFFECTIVE_DATE} and {COMMITMENT.COMMIT_STATUS_VALUE} = "xxxxxxxxxxxxxxxxx"
then count({TX_COMMITMENT.COMMIT_STATUS_VALUE}) else 0
stumped... I've also removed the "else 0" clause, and it had no effect.
Oh- I dont think it matters, but this is reporting from an Oracle 9i DSS, which is replicated nightly from a Caché flat file database.