Quantcast
Channel: SQL Server Reporting Services, Power View forum
Viewing all articles
Browse latest Browse all 28687

Display or Format days, Month and years in ssrs 2008

$
0
0

hi,

  i have my reports running in my ssrs 2008. but the problem is that i cant display properly if a user select more than 2 or three but to select only 1 it display correctly.eg. when i select 3years plus 11 days, output display is 3.11 years which does not have a meaning..all i want is that 3 years 11 days.and this should be the same if i select months too eg 3 years 2 months 11 days..

my code is something like this..

Public Function NaturalLength(length As Integer) As String
    ' days 0 - 60
    ' months 61 - 730
    ' years 731 plus
    If length = 0 then
        Return String.Empty
    ElseIf length < 61 Then
        Return String.Format("{0} days", length)
    ElseIf length > 60 AndAlso length < 731 Then
        Return String.Format("{0:0.0} months", length / 30.4375)
    Else
        Return String.Format("{0:0.0} years", length / 365.25)
    End If

End Function

in my expression i had

Code.NaturalLength(Avg(Fields!Length.Value))..to take out the average of a entered field

i need help, if anyone can figure it where i get wrong.thanks for being patient...

Thanks in advance


A.Vadz



Viewing all articles
Browse latest Browse all 28687


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>