textformat TimeSpan (and totals of a TimeSpan)

Stimulsoft Reports.NET discussion
J_S
Posts: 49
Joined: Mon Sep 22, 2008 3:10 am
Location: Netherlands

textformat TimeSpan (and totals of a TimeSpan)

Post by J_S »

Hi,

When I use a TimeSpan as datasource, the text formatting does not work. When I use the same formatting in a DateTime field, it works.

For example the format HH:mm. When I use the TimeSpan, I get 08:13:00, with the DateTime I get 08:13

Also getting the total value of several TimeSpan values does not work.

Can you please support text formatting and getting totals for the TimeSpan type?

Regards,

Joost
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

textformat TimeSpan (and totals of a TimeSpan)

Post by Edward »

Hi

The issue is confirmed. Now this feature is in our to do list. We will inform you about our progress in this topic.

Thank you.
chris.procter
Posts: 32
Joined: Wed Jun 10, 2009 4:48 pm
Location: Edmonton

textformat TimeSpan (and totals of a TimeSpan)

Post by chris.procter »

I just ran in to the problem of summing TimeSpans, so I'd be interested in this issue also.
Thanks

Edit: As a workaround for now, I'm doing something like

Code: Select all

TimeSpan ts = new TimeSpan((long)Totals.Sum(DataEventItem,EventItems.TotalTime.Ticks));
e.Value = ts.Hours + ":" + ts.Minutes + ":" + ts.Seconds;
(with a bit of formatting left to go) in the GetValue event of my text box.
Jan
Posts: 1265
Joined: Thu Feb 19, 2009 8:19 am

textformat TimeSpan (and totals of a TimeSpan)

Post by Jan »

Hello Joost,
When I use a TimeSpan as datasource, the text formatting does not work. When I use the same formatting in a DateTime field, it works.

For example the format HH:mm. When I use the TimeSpan, I get 08:13:00, with the DateTime I get 08:13
Problem fixed. Please check build from 6 July.
Also getting the total value of several TimeSpan values does not work.

Can you please support text formatting and getting totals for the TimeSpan type?
New total functions will be available in build from 6 July - SumTime, AvgTime, MinTime and MaxTime.

Thank you.
J_S
Posts: 49
Joined: Mon Sep 22, 2008 3:10 am
Location: Netherlands

textformat TimeSpan (and totals of a TimeSpan)

Post by J_S »

I just downloaded the latest prerelease and unfortunately it still does not work...

I have a timespan value field in my report and set the text format with the predefined formats like HH:mm or H:mm, but I still can see the seconds.

Also the sum does not work. In my report I see HH:mm instead of the real value, also with the predefined text formats. When I use no formatting at all, the sum of my timespan values is zero all the time...



edit:
It turned out I had to remove the references and add them again. Now it works more or less. The formatting does not work in my sumtime field and does also not work when I add a condition to a field

edit 2:
It looks like the formatting does not work with negative values.
Ivan
Posts: 960
Joined: Thu Aug 10, 2006 1:37 am

textformat TimeSpan (and totals of a TimeSpan)

Post by Ivan »

Hello,
J_S wrote:It turned out I had to remove the references and add them again. Now it works more or less. The formatting does not work in my sumtime field and does also not work when I add a condition to a field.
It looks like the formatting does not work with negative values.
Can you please send us a sample report with data, which reproduce the issue?

Thank you.

J_S
Posts: 49
Joined: Mon Sep 22, 2008 3:10 am
Location: Netherlands

textformat TimeSpan (and totals of a TimeSpan)

Post by J_S »

I have added an attachment.
Attachments
209.ReportTest.zip
(51.13 KiB) Downloaded 486 times
J_S
Posts: 49
Joined: Mon Sep 22, 2008 3:10 am
Location: Netherlands

textformat TimeSpan (and totals of a TimeSpan)

Post by J_S »

Hello,

I would like to now if there is any progress or information about this problem.

Kind regards.

PS. Another nice default time formatting option would be the time as *.HH:mm, so the day value would only be shown if there is any or is larger than 0.
Ivan
Posts: 960
Joined: Thu Aug 10, 2006 1:37 am

textformat TimeSpan (and totals of a TimeSpan)

Post by Ivan »

Hello,
J_S wrote:It looks like the formatting does not work with negative values.
We made some improvements in that direction.
Now your test application work correctly.
Patch will be available in next prerelease build from 24-Aug-2009.

Thank you.
jay@bplogix.com
Posts: 251
Joined: Fri Feb 04, 2011 11:46 am
Location: San Diego, CA

textformat TimeSpan (and totals of a TimeSpan)

Post by jay@bplogix.com »

I am still unable to format a TimeSpan object in reports (Reports.Web). Is this now possible? What do I set the format string to if I want to see days and hours of a TimeSpan?

Thanks
Post Reply