在报表生成器3.0中显示更多24小时 [英] Show more of 24 hours in report builder 3.0

查看:52
本文介绍了在报表生成器3.0中显示更多24小时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我的每个例子显示更多24小时:



我有这个35:25 :12(文本格式)是小时,分钟,秒,但是当我尝试在值中显示图形时,此数据未显示或无法绘制为小时数,其他数据则表示来自数据库的日期/时间它们可以正确地绘制,但由于
这是一种文本格式,然后它给我工作将其转换为我已经拥有的其他数据的时间。


谁可以告诉我如何格式化该字符串并将其转换为超过24小时的时间?


解决方案

嗨MannyDevs,


根据您的描述,数据来自DB时间数据类型吗?


我的建议是你可以转换文本格式的时间跨度以及你的日期从数据库到小时的小时数,并将它们一起绘制。 


我为你的问题编写了一个函数,我精确到3小时小数,你可以改变如你所愿。


使用= code.GetHoursFromTime(Fields!texttime.value)和  = code.GetHoursFromTime(Fields!DBtime.value.ToString)to获取图表的

公共函数GetHoursFromTime (ByVal timespan as String)As Double 
Dim totalhours As Double

Dim days As Double
Dim hours As Double
Dim minutes As Double
Dim seconds As Double
Dim index As Integer

如果timepan Is Nothing则
返回0
结束如果

Dim temp As String
temp = timespan

index = temp.IndexOf(":")
如果-1<> index然后
If IsNumeric(Right(Left(temp,index),1))= False然后
hours = CDbl(Left(temp,index-1))
Else
hours = CDbl(Left(temp,index))
如果
temp = Right(temp,temp.Length - index - 1)
index = temp.IndexOf(":" )
如果-1<> index然后
分钟= CDbl(左(temp,index))
temp =右(temp,temp.Length - index - 1)
index = temp.IndexOf(":" )
如果-1<> index然后
天=小时
小时=分钟
分钟= CDbl(左(temp,index))
temp =右(temp,temp.Length - index - 1)
秒= CDbl(临时)
否则
秒= CDbl(临时)
结束如果
结束如果
结束如果

totalhours =秒/ 3600 +分钟/ 60 +小时+ 24 *天
totalhours = round(totalhours,3)
返回totalhours
结束功能

希望这会有所帮助


最好的问候,


Lukas



I have that show more of 24 hrs per example:

I have this 35:25:12 (text format) is Hours, minutes, seconds, but when I try to show in the graphics in Values, this data is not seen or can not be plotted as hours, other data that is as date / time from the DB if they can be plotted correctly, but since this is a text format, then it is giving me work to convert it to time as the other data that I already have.

who can tell me how to format that string and convert it to time to more than 24 hours?

解决方案

Hi MannyDevs,

According to your description, are the data from DB time datatype?

My suggest is that you could convert the text format timespan and also your date from DB both into Hours with decimal, and plot them together. 

I wrote a function for your issue, I have round the hours with accuracy to 3 decimal and you can change as you want.

Use =code.GetHoursFromTime(Fields!texttime.value) and =code.GetHoursFromTime(Fields!DBtime.value.ToString) to get the value for chart.

Public Function GetHoursFromTime(ByVal timespan as String) As Double    
        Dim totalhours As Double

        Dim days As Double
        Dim hours As Double
        Dim minutes As Double
        Dim seconds As Double
        Dim index As Integer

        If timespan Is Nothing Then 
	Return 0
        End if

        Dim temp As String
        temp = timespan

        index = temp.IndexOf(":")
        If -1 <> index Then
            If IsNumeric(Right(Left(temp, index), 1)) = False Then
	              hours = CDbl(Left(temp, index-1))
            Else
                  hours = CDbl(Left(temp, index))
            End if
            temp = Right(temp, temp.Length - index - 1)
            index = temp.IndexOf(":")
            If -1 <> index Then
                minutes = CDbl(Left(temp, index))
                temp = Right(temp, temp.Length - index - 1)
                index = temp.IndexOf(":")
                If -1 <> index Then
                    days = hours
                    hours = minutes
                    minutes = CDbl(Left(temp, index))
                    temp = Right(temp, temp.Length - index - 1)
                    seconds = CDbl(temp)
                Else
                    seconds = CDbl(temp)
                End If
            End If
        End If

        totalhours = seconds/3600 + minutes/60 +  hours + 24 * days
        totalhours = round(totalhours,3)
        Return totalhours
End Function

Hope this helps

Best Regards,

Lukas


这篇关于在报表生成器3.0中显示更多24小时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆