Crosstable timeformat

4 posts, 0 answers
  1. Stijn
    Stijn avatar
    1 posts
    Member since:
    Aug 2012

    Posted 03 Aug 2012 Link to this post

    I created a crosstable
    Rows contains the projects
    columns contains persons.
    In the value fields i would like the sum of total spend time
    At this the total it is returned like 1.04:00:00 (so 1 day and 4hrs)
    however i want it in hours only, in this case 28:00:00
    Tried to change it by setting the format on the field, but it doesn't work
    any suggestions?
  2. Peter
    Peter avatar
    1631 posts

    Posted 08 Aug 2012 Link to this post

    Hi Stijn,

    You can use the following expression to display the TimeSpan data in the required format:

    =Fields.TimeSpanField.TotalHours.ToString("N0") + Fields.TimeSpanField.ToString("\:mm\:ss")

    Kind regards,
    the Telerik team

    BLOGGERS WANTED! Write a review about Telerik Reporting or the new Report Designer, post it on your blog and get a complimentary license for Telerik Reporting. We’ll even promote your blog and help bring you a few fresh readers. Yes, it’s that simple. And it’s free. Get started today >

  3. Olivier
    Olivier avatar
    3 posts
    Member since:
    Jan 2012

    Posted 08 Apr 2014 in reply to Peter Link to this post

    I have the same question in a table.

    I have a column to calculate the spend time
    and i want to do a sum on a raw group of the spend time and i have this result "2.02:00:00"

    I do your suggestion like

    =sum (Fields.TimeSpanField.TotalHours.ToString("N0") + Fields.TimeSpanField.ToString("\:mm\:ss"))

    But in the result i have all the raw ( 2:00:00 2:00:00 2:00:00) instead of 6:00:00 for example.
  4. Nasko
    Nasko avatar
    944 posts

    Posted 11 Apr 2014 Link to this post

    Hello Olivier,

    You are passing a string to the Sum aggregate function. This will result in a concatenation of the strings, which were passed to the aggregate function. To avoid this, either pass the correct type of data to the aggregate function, or create your own custom aggregate function which will handle the data as you desire.


    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

Back to Top