You have to account for the fact that the time fields in your case are character fields. You will need to use variables as follows:
//first get the length of the fields to see if the hour is one digit or two digits.
numbervar lenst := len((VWDEPSTAT.REQTIME});
numbervar lenen := len({VWDEPSTAT.FINTIME});
//find out if it is am or pm
booleanvar ispmst := "pm" in (VWDEPSTAT.REQTIME};
booleanvar ispmen := "pm" in (VWDEPSTAT.FINTIME};
//now get the proper hours for start and end
numbervar hrst := IF lenst = 5 then
if ispmst then val({VWDEPSTAT.REQTIME}[1] + 12 else
val({VWDEPSTAT.REQTIME}[1];
numbervar hren := IF lenen = 5 then
if ispmen then val({VWDEPSTAT.ENDTIME}[1] + 12 else
val({VWDEPSTAT.ENDTIME}[1];
//now get the minutes
numbervar minst := if lenst = 5 then val((VWDEPSTAT.REQTIME}[2 to 3]) else val((VWDEPSTAT.REQTIME}[3 to 4]);
numbervar minend := if lenen = 5 then val( (VWDEPSTAT.FINTIME}[2 to 3]) else val((VWDEPSTAT.FINTIME}[3 to 4]);
//now get the number of min after midnight
numbervar totminstart := hrst*60+minst;
numbervar totminend := hren*60+minend;
//now subtract
numbervar totmin := totminend-totminstart;
All this assumes that both start and end are on the same day, if not you will have to add logic to account for that.
I have not checked the spelling or syntax of the above code.
I may have left out a comma or parenthesis.
best regards,
Howard
else if lenen = 5 then
numbervar sthr := IIF(ispm,
Howard Hammerman,
Crystal Training and Crystal Material
On-site classes and one-on-one coaching
Low-cost telephone/email support
FREE independent Crystal newsletter
howard@hammerman.com
800-783-2269