Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with expression for cycle time

Status
Not open for further replies.

tkaz

Technical User
Feb 21, 2005
75
US
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))
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top