Groups | Blog | Home
all groups > sql server reporting services > may 2007 >

sql server reporting services : format when taking two fields away from other


jewelfire
5/6/2007 6:43:27 PM
hi there

can someone show me how to format the following please

=(Fields!SLAResolutionDate.Value)-(Fields!CreatedDate.Value)

these are both date/time fields - I want to format to just day - two
digits and just time - two digits



so like this =Format(Fields!SLAResolutionDate.Value)-(Fields!
CreatedDate.Value), dd, hh

but I am unsure where to stop and start the brackets to get the
result.

thanks
jewel
Michael C
5/8/2007 9:20:02 AM
Not sure if this is the simplest, but it will work.

Try this:
'This first part finds only the "whole days". The second part determines
the "left over hours".

Format(DATEDIFF(d,
Fields!SLAResolutionDate.Value,Fields!CreatedDate.Value),"00") & " " &
Format(DATEDIFF(d, Fields!SLAResolutionDate.Value,Fields!CreatedDate.Value) *
24 - DATEDIFF(hh,
Fields!SLAResolutionDate.Value,Fields!CreatedDate.Value),"00")

Michael

[quoted text, click to view]
Michael C
5/8/2007 9:29:03 AM
Correction: the second part should be reversed (hours - days*24):

Format(DATEDIFF(d,
Fields!SLAResolutionDate.Value,Fields!CreatedDate.Value),"00") & " " &
Format(DATEDIFF(hh,
Fields!SLAResolutionDate.Value,Fields!CreatedDate.Value)-
DATEDIFF(d, Fields!SLAResolutionDate.Value,Fields!CreatedDate.Value) *
24,"00")


[quoted text, click to view]
jewelfire
5/8/2007 8:10:17 PM
thanks Michael

I get the error 'd' is not declared.

I am putting this in the expression on the layout view.

thanks
jewel



On May 9, 4:29 am, Michael C <Micha...@discussions.microsoft.com>
[quoted text, click to view]

Michael C
5/9/2007 9:24:02 AM

Try using dd instead of just d, and be sure there are no quotes around it.
Here is the MSDN file for valid entries!

http://msdn2.microsoft.com/en-us/library/ms189794.aspx


[quoted text, click to view]
jewelfire
5/9/2007 5:57:39 PM
hi Michael

tried as below

=Format(DATEDIFF(dd,Fields!SLAResolutionDate.Value,Fields!
CreatedDate.Value),"00") & " " &
Format(DATEDIFF(hh,Fields!SLAResolutionDate.Value,Fields!
CreatedDate.Value)-
DATEDIFF(dd, Fields!SLAResolutionDate.Value,Fields!CreatedDate.Value)
*
24,"00")


dd - this is underlined and in red but the 2nd instance is not.

showing red on
"00") & " " &
"00")

probably something very simple! thanks for your help
thanks
jewel


On May 10, 4:24 am, Michael C <Micha...@discussions.microsoft.com>
[quoted text, click to view]

AddThis Social Bookmark Button