calculation result is in text, is there a way to achieve it in numerical format.

Comments

3 comments

  • Rainer Grabowski

    Hi Jayraj,

    On level 2 you can simply use

    @sum of duration

    The result is a number like 10.5 (= 10 hours 30 minutes)

    The on level 1:

    @sum of calculation field level 2

    If you really need to show it on level 2 as text and not as number  you need on level 1 a for loop which pulls the numbers from the level 2 strings and parses them to numbers:

    var l2 = @all of calculation field level 2;
    hrs = 0;
    min = 0;
    for(var i = 0;  i < l2.length; i++){
    hours = Number( l2[i].split(":")[0]) || 0;
    minutes = Number(l2[i].split(":")[1]) || 0;
    hrs += hours;
    min += minutes;
    };
    var hrs  = hrs +  parseInt(min/60);
    var min = Math.round(min % 60);
    hrs + ":" + min

    Rainer

    0
    Comment actions Permalink
  • Jayraj Berde

    Hi Rainer,

    Awesome I don't how I couldn't generate that it was so easy. But the total results in numbers hh.mm is a little higher than the text calculation. Maybe the minutes calculation is not applied in the sum. But it should work for now.

    0
    Comment actions Permalink
  • Rainer Grabowski

    Hi Jayraj,

    they shouldn't be different. Can you share screen shots of both calculations (level 1 and level 2)?  

    Rainer

    0
    Comment actions Permalink

Please sign in to leave a comment.

Powered by Zendesk