I'm using SSRS 2008 and have a report where I need to calculate cycle time between ticket times for each truck. I have the following expression working, but it is not working when the vehicleid changes. I do not want a cycle time for the first load picked up by a truck, but a time between first and second load, second and third load, etc.
I had a variable written for this report in Crystal but I simply don't know how to convert it to make it work in SSRS. Can anyone help me, please?
THIS WAS MY CODE IN CRYSTAL...
whileprintingrecords;
numberVar dur := datediff("s",{vwAMS_TCKH_TLDH_CUST_PLNT.TICKET_DATE}, Previous({vwAMS_TCKH_TLDH_CUST_PLNT.TICKET_DATE}));
numberVar hrs;
numberVar min;
numberVar sec;
stringVar hhmmss;
hrs := Truncate(Truncate(dur/-60)/60);
min := Remainder(Truncate(dur/-60),60);
sec := Remainder(dur,60);
hhmmss := totext(hrs,"00") + ":" + totext(min,"00") + ":" + totext(sec,"00");
if onfirstrecord or
({vwAMS_TCKH_TLDH_CUST_PLNT.VEHICLE_NBR}) <> previous({vwAMS_TCKH_TLDH_CUST_PLNT.VEHICLE_NBR}) then
"" else
hhmmss
= IIF (Fields!TicketTime.Value <=Previous (Fields!TicketTime.Value),"",
Fields!TicketTime.Value-Previous(Fields!TicketTime.Value))
I had a variable written for this report in Crystal but I simply don't know how to convert it to make it work in SSRS. Can anyone help me, please?
THIS WAS MY CODE IN CRYSTAL...
whileprintingrecords;
numberVar dur := datediff("s",{vwAMS_TCKH_TLDH_CUST_PLNT.TICKET_DATE}, Previous({vwAMS_TCKH_TLDH_CUST_PLNT.TICKET_DATE}));
numberVar hrs;
numberVar min;
numberVar sec;
stringVar hhmmss;
hrs := Truncate(Truncate(dur/-60)/60);
min := Remainder(Truncate(dur/-60),60);
sec := Remainder(dur,60);
hhmmss := totext(hrs,"00") + ":" + totext(min,"00") + ":" + totext(sec,"00");
if onfirstrecord or
({vwAMS_TCKH_TLDH_CUST_PLNT.VEHICLE_NBR}) <> previous({vwAMS_TCKH_TLDH_CUST_PLNT.VEHICLE_NBR}) then
"" else
hhmmss
= IIF (Fields!TicketTime.Value <=Previous (Fields!TicketTime.Value),"",
Fields!TicketTime.Value-Previous(Fields!TicketTime.Value))