I have a crystal report that I am moving to reporting services that flags deliveries that are running late.
In crystal I used formula to convert seconds to the format I need, in the new report they would rather I used minutes as my base, either way I am a bit lost as doing date formula calculations in Reporting services is a nightmare So I am trying to do it sql side.
Old Crystal Formulas:
How can I do something similar as above useing sql as part of my stored procedure?
I can probably wiggle out the time zone part of it, if someone can help me with the conversion side.
Thanks for any assistance
Julie
CRXI CE10 / RS2005 Sql DB
In crystal I used formula to convert seconds to the format I need, in the new report they would rather I used minutes as my base, either way I am a bit lost as doing date formula calculations in Reporting services is a nightmare So I am trying to do it sql side.
Old Crystal Formulas:
Code:
Datetimevar MyDate;
--Time Zone
if {dc.cty_GMTDelta} = 4 then
MyDate:=dateadd("h",-1,{s.stp_arrivaldate})
else
if {dc.cty_GMTDelta} = 6 then
MyDate:=dateadd("h",1,{s.stp_arrivaldate})
else
if {dc.cty_GMTDelta} = 7 then
MyDate:=dateadd("h",2,{s.stp_arrivaldate})
else
if {dc.cty_GMTDelta} = 8 then
MyDate:=dateadd("h",3,{s.stp_arrivaldate})
else
MyDate := {s.stp_arrivaldate}
--Conversion
evaluateafter({@MyDate});
Datetimevar MyDate;
numbervar tsecs := datediff("s",MyDate,currentdatetime);
numbervar ndays := truncate(tsecs/86400);
tsecs := remainder(tsecs,86400);
numbervar nhours := truncate(tsecs/3600);
tsecs := remainder(tsecs,3600);
numbervar nmin := truncate(tsecs/60);
tsecs := remainder(tsecs,60);
if nhours-24<=0 then totext(ndays,0)+"D: "+totext(nhours,0)+"H: "+ totext(nmin,0)+
"M: "
How can I do something similar as above useing sql as part of my stored procedure?
Code:
select
o.ord_hdrnumber,
o.ord_refnum,
o.ord_startdate,
s.stp_arrivaldate,
s.stp_schdtlatest,
s.stp_city,
oc.cty_nmstct as Origin,
dc.cty_nmstct as Destination,
--got the minutes but need conversion
datediff(mi,s.stp_schdtlatest,stp_arrivaldate)as MinLate
--end conversion
from orderheader o,stops s, city oc,city dc
where o.ord_hdrnumber=s.ord_hdrnumber
and o.ord_status = 'CMP'
and oc.cty_code=o.ord_origincity and dc.cty_code = o.ord_destcity
and s.stp_city = dc.cty_code
order by stp_arrivaldate
I can probably wiggle out the time zone part of it, if someone can help me with the conversion side.
Thanks for any assistance
Julie
CRXI CE10 / RS2005 Sql DB