Page 2 of 2
textformat TimeSpan (and totals of a TimeSpan)
Posted: Tue May 17, 2011 5:34 pm
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
textformat TimeSpan (and totals of a TimeSpan)
Posted: Wed May 18, 2011 8:30 am
by Jan
Hello Jay,
I am still unable to format a TimeSpan object in reports (Reports.Web).
Sorry I can't reproduce this problem. I try to format TimeSpan value with help of TextFormat function and it work fine. Can you provide expression which you use?
What do I set the format string to if I want to see days and hours of a TimeSpan?
For example:
Code: Select all
{MyTimeSpanValue.Days}
{MyTimeSpanValue.Hours}
Thank you.
textformat TimeSpan (and totals of a TimeSpan)
Posted: Thu May 19, 2011 2:53 pm
by jay@bplogix.com
Basically I want to use the Text Format to display a TimeSpan as Days:Hours:Minutes
I know I can do this "long hand" using {ts.Days}:{ts.Hours}:{ts.Minutes}
BUT how do I use a format string for the days? dd:HH:mm almost works ... but the dd always returns todays day number instead of the actual days in the timespan object.
ALSO ... the Custom format does not seem to work at all. If any value (for a TimeSpan object) is used in the Format Mask field, it behaves as if there were NO format string. The TimeSpan object only seems to look at the Format if you use a built-in format string (in the Date or Time groups).
To reproduce this, simply place this text control on a Report Header
{DateDiff(new DateTime(2011, 1, 1, 12, 44, 0), new DateTime(2011, 1, 7, 7, 0, 0))}
Then format it with a "custom format" of HH:mm ... notice that it does not listen.
Then choose a built-in Time format of HH:mm ... notice is does work.
Then choose a built-in Time format of dd:HH:mm (you may have to edit en.xml to add this format since custom format does not work) ... notice that the dd is always todays day number, not the days of the TimeSpan object.
Thansk!
textformat TimeSpan (and totals of a TimeSpan)
Posted: Mon May 23, 2011 2:45 am
by Alex K.
Hello,
Please send us sample report which reproduces the issue for analysis.
Thank you.
textformat TimeSpan (and totals of a TimeSpan)
Posted: Mon May 23, 2011 5:02 pm
by jay@bplogix.com
Attached is the ZIP of the MRT. Basically I am trying to use ANY format string for a TimeSpan object. Right now, NO custom format strings work.
textformat TimeSpan (and totals of a TimeSpan)
Posted: Wed May 25, 2011 5:34 am
by Alex K.
Hello,
Support for formatting TimeSpan values was added in the .NET Framework version 4. However, the ToString() method overload remains culture-insensitive. Its behavior remains unchanged from previous versions of the .NET Framework.
For example, you can use the following formating:
Code: Select all
TimeSpanValue.ToString("%d")
TimeSpanValue.ToString("%d\:hh")
TimeSpanValue.ToString("%d\:hh\:mm")
TimeSpanValue.ToString("%d\:hh\:mm\.ss")
...
Thank you.
textformat TimeSpan (and totals of a TimeSpan)
Posted: Wed May 25, 2011 1:04 pm
by jay@bplogix.com
How will this work on charts? I have input data that looks like this:
Region TimeSpan
A 1:10:34
B 2:40:24
The TimeSpan column is of type TimeSpan ... I want the chart to show a bar chart (2 bars ... A and B) of total hours in the timespan. I have attached an MRT that shows this. For the simple example I am using "List of Values" to point to 2 TimeSpan objects calculated from a formula. In my actual reports, the TimeSpan object is a column in a DataSource and I use "Value Data Column" to point to the column.
How do I format the TimeSpan in the cahrt to show total hours (or total days, or total minutes)? I cannot add a ToString to this, and the "Value Data Column" does not seem to allow me to add .TotalDays
Thanks
textformat TimeSpan (and totals of a TimeSpan)
Posted: Thu May 26, 2011 2:40 am
by Alex K.
Hello,
Sorry, but on the current moment, it is not possible to use the TimeSpan type by the calculated axis of a chart.
We have added your request to our to-do list, but I cannot say when it will be available.
Thank you.