What is the best practice for sum up the time?

Stimulsoft Reports.NET discussion
Post Reply
ssaturn
Posts: 13
Joined: Mon Jun 07, 2010 5:05 am
Location: Malaysia

What is the best practice for sum up the time?

Post by ssaturn »

Hi,

I have a question on how to sum up a time (1 hour + 30 min + 2 hours) = 3 hours 30 min in Cross-Tabs. Any best practice available? What kind of data type I should use in SQL? datetime?

Thanks in advance for help :)

Regards,
John
Jan
Posts: 1265
Joined: Thu Feb 19, 2009 8:19 am

What is the best practice for sum up the time?

Post by Jan »

Hello John,

Our report engine have SumTime aggregate function which you can find in report dictionary. This function accepts TimeSpan objects.

Thank you.
ssaturn
Posts: 13
Joined: Mon Jun 07, 2010 5:05 am
Location: Malaysia

What is the best practice for sum up the time?

Post by ssaturn »

Jan wrote:Hello John,

Our report engine have SumTime aggregate function which you can find in report dictionary. This function accepts TimeSpan objects.

Thank you.
I tried using it

{SumTime(reportTimeShift.tsd_value)}

return result is 0:00:00

I am not sure "reportTimeShift.tsd_value" how it should be, I store the value as bigint in sql. Any datatype conversion need to be done here?
Jan
Posts: 1265
Joined: Thu Feb 19, 2009 8:19 am

What is the best practice for sum up the time?

Post by Jan »

Hello,

Yes of course you need convert your values to TimeSpan type, because SumTime function can work only with TimeSpan type. You can use following expression to convert your values to TimeSpan:

Code: Select all

TimeSpan.FromDays(double value)
TimeSpan.FromHours(double value)
TimeSpan.FromMilliseconds(double value)
TimeSpan.FromMinutes(double value)
TimeSpan.FromSeconds(double value)
TimeSpan.FromTicks(long value)
Thank you.
ssaturn
Posts: 13
Joined: Mon Jun 07, 2010 5:05 am
Location: Malaysia

What is the best practice for sum up the time?

Post by ssaturn »

Well, I have another question on how to convert a time (sec) into hh:mm Format in Cross Tab.

I have a value like 27900 sec in Cross Tab, then I do function (27900/60)/60 instead of 7.75, it gave me 7.. this is not what I want :(

I wish there is a Converter that ca convert Sec to Hour/Min (hh:mm)
Jan
Posts: 1265
Joined: Thu Feb 19, 2009 8:19 am

What is the best practice for sum up the time?

Post by Jan »

Hello,

Code: Select all

TimeSpan.FromSeconds(value)
Thank you.
Nirali213
Posts: 11
Joined: Wed Sep 09, 2020 6:22 am

Re: What is the best practice for sum up the time?

Post by Nirali213 »

Hello, i have a question of how to merge two same row and sum up time of that row which is diffrent. I am using Version 2020.1.1 from 18 December 2019, PHP, JS.
Nirali213
Posts: 11
Joined: Wed Sep 09, 2020 6:22 am

Re: What is the best practice for sum up the time?

Post by Nirali213 »

I attached my report here please reply me as early as possible.
Attachments
summryreport1.mrt
(26.27 KiB) Downloaded 158 times
Lech Kulikowski
Posts: 6196
Joined: Tue Mar 20, 2018 5:34 am

Re: What is the best practice for sum up the time?

Post by Lech Kulikowski »

Hello,

Sorry, maybe we did not exactly understand your question. Could you explain your issue in more detail?

Thank you.
Post Reply