Hi,
I have the following formula:
numbervar mindiff;
if isnull({PATDRUG.APPT_START})or
trim({PATDRUG.APPT_START}) in [":",""] or
isnull({PATDRUG.PRESC_TIME})or
trim({PATDRUG.PRESC_TIME}) in [":",""] or
isnull({PATDRUG.START_TIME})or
trim({PATDRUG.START_TIME}) in [":",""] or
isnull({PATDRUG.DRUG_TIME})or
trim({PATDRUG.DRUG_TIME}) in [":",""]
then
mindiff := 0 else
mindiff := datediff("n",datetime(currentdate, time({PATDRUG.APPT_START})),datetime(currentdate,time({PATDRUG.DRUG_TIME})));numbervar hrs := truncate(mindiff/60);
numbervar mins := remainder(mindiff,60);
if mindiff = 0 then
"" else
totext(hrs,"00")+":"+totext(mins,"00")
It looks at the difference between 2 times, patient appointment time, and when the drugs are ready. The problem is, a negative character appears for hours and minutes if the first time is greater than the second.
Eg Patient appointment time 13.30, drugs ready 11.50 the output for this is -01:-40
Its putting the negative character for both the hour and minute...
Is there a way of removing this from the minute field ?
Any help greatly appreciated as ever
Steve
I have the following formula:
numbervar mindiff;
if isnull({PATDRUG.APPT_START})or
trim({PATDRUG.APPT_START}) in [":",""] or
isnull({PATDRUG.PRESC_TIME})or
trim({PATDRUG.PRESC_TIME}) in [":",""] or
isnull({PATDRUG.START_TIME})or
trim({PATDRUG.START_TIME}) in [":",""] or
isnull({PATDRUG.DRUG_TIME})or
trim({PATDRUG.DRUG_TIME}) in [":",""]
then
mindiff := 0 else
mindiff := datediff("n",datetime(currentdate, time({PATDRUG.APPT_START})),datetime(currentdate,time({PATDRUG.DRUG_TIME})));numbervar hrs := truncate(mindiff/60);
numbervar mins := remainder(mindiff,60);
if mindiff = 0 then
"" else
totext(hrs,"00")+":"+totext(mins,"00")
It looks at the difference between 2 times, patient appointment time, and when the drugs are ready. The problem is, a negative character appears for hours and minutes if the first time is greater than the second.
Eg Patient appointment time 13.30, drugs ready 11.50 the output for this is -01:-40
Its putting the negative character for both the hour and minute...
Is there a way of removing this from the minute field ?
Any help greatly appreciated as ever
Steve