Hi everyone,
I can't seem to figure out what's going on with my Crystal Report (XI).
I built a report that displays patient cancellations. I have to calculate the number of days since their last completed appointment.
On the main report I have the list of cancelled appointments. I created a subreport grouped by patient ID # to pull the latest completed appointment. (Patient ID# and appointment type are supressed fields in the sub report). I added the subreport to the main report by just inserting the entire report in the detail section of the main report. The subreport is linked to the main report by the patient's ID # and the type of appointment. This works perfectly.... however I forgot I had to calculate the number of days between the appointments.
So... to use the latest appointment value in a formula in the main report, I created a shared variable in the subreport and display it in the main report. The Shared variable is placed in the detail section of the main report.
Shared variable code in subreport:
shared datetimevar maxApptDt;
whileprintingrecords;
If isnull({Schedule.Appt_DtTm}) then DateTime("01/01/1900 12:00:00 PM")
else
maxApptDt := maximum({Schedule.Appt_DtTm})
Shared variable code in main report:
whileprintingrecords;
shared datetimevar maxApptDt;
maxApptDt
My main report now displays different values for the latest appointment when I'm thinking they should display the same values. The shared variable seems to be one row off - like the values shifted down.
For example:
Main report display
(@maxApptDt)
Patient ID Appt Date Last Appt subreport
XXXXXX 5/27/2015 8:45AM <blank> 5/27/2015 5:00PM
YYYYYY 5/27/2015 9:00AM 5/27/2015 5:00PM <blank>
ZZZZZZ 5/27/2015 9:30AM < blank> 5/20/2015 9:30AM
AAAAAA 5/27/2015 10:00AM 5/20/2015 9:30AM 5/20/2015 10:00AM
For patient XXXXX I am expecting the shared variable @maxApptDt to return the date of 5/27/2015 5:00PM since they were fit in to see the doctor at a later time... but that time appears for patient YYYYY instead.
Any ideas on how I can fix this? :banghead:
Thanks!!
I can't seem to figure out what's going on with my Crystal Report (XI).
I built a report that displays patient cancellations. I have to calculate the number of days since their last completed appointment.
On the main report I have the list of cancelled appointments. I created a subreport grouped by patient ID # to pull the latest completed appointment. (Patient ID# and appointment type are supressed fields in the sub report). I added the subreport to the main report by just inserting the entire report in the detail section of the main report. The subreport is linked to the main report by the patient's ID # and the type of appointment. This works perfectly.... however I forgot I had to calculate the number of days between the appointments.
So... to use the latest appointment value in a formula in the main report, I created a shared variable in the subreport and display it in the main report. The Shared variable is placed in the detail section of the main report.
Shared variable code in subreport:
shared datetimevar maxApptDt;
whileprintingrecords;
If isnull({Schedule.Appt_DtTm}) then DateTime("01/01/1900 12:00:00 PM")
else
maxApptDt := maximum({Schedule.Appt_DtTm})
Shared variable code in main report:
whileprintingrecords;
shared datetimevar maxApptDt;
maxApptDt
My main report now displays different values for the latest appointment when I'm thinking they should display the same values. The shared variable seems to be one row off - like the values shifted down.
For example:
Main report display
(@maxApptDt)
Patient ID Appt Date Last Appt subreport
XXXXXX 5/27/2015 8:45AM <blank> 5/27/2015 5:00PM
YYYYYY 5/27/2015 9:00AM 5/27/2015 5:00PM <blank>
ZZZZZZ 5/27/2015 9:30AM < blank> 5/20/2015 9:30AM
AAAAAA 5/27/2015 10:00AM 5/20/2015 9:30AM 5/20/2015 10:00AM
For patient XXXXX I am expecting the shared variable @maxApptDt to return the date of 5/27/2015 5:00PM since they were fit in to see the doctor at a later time... but that time appears for patient YYYYY instead.
Any ideas on how I can fix this? :banghead:
Thanks!!