Highlighted
Super Contributor.. Super Contributor..
Super Contributor..
723 views

how to add two duration

Hi Expert,

I had manage to poplute the duration for all my tasak ticket. now I'm trying to sum up the total duration taken by all the task, please advice how to do it?

I'm using 

date1 = Math.floor( (new Date( starttime ).getTime()) /1000);
date2 = Math.floor((new Date( endtime ).getTime())/1000);
duration = system.functions.val((date2- date1), 3);

which return me value of dd hh:mm:ss

now I need to sum all these together but when I try system.functions.val(duration,1) it a null value

Regards

Soong

 

Regards
Soong
0 Likes
6 Replies
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: how to add two duration

Where do you use this ?

0 Likes
Highlighted
Super Contributor.. Super Contributor..
Super Contributor..

Re: how to add two duration

Hi,

I'm using this in my request ticket,  on initial, it will check the list of task related to the ticket.  then get the duration of each task ticket and store into a temp array ( let call it duration). then I do a for loop.

var totalduraton = 0;

for(i=0;i<duration.lenght();i++){

totalduration= totalduration + duration[i];

}

 

Regards
Soong
0 Likes
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: how to add two duration

Task ticket - you mean line item - OCML table ?

And you need to calculate the total duration of all Line items for one request ?

0 Likes
Highlighted
Super Contributor.. Super Contributor..
Super Contributor..

Re: how to add two duration

Hi,

Sorry, don't quite understand about hte line item. What I'm trying to do is, to sum up all the task duration. 

Example: I had a request ticket RF123, in this ticket there is 3 task RFT1 , RFT2, RFT3.

RFT1 from open to close took 3 01:30:00

RFT2 from open to close took 5 01:30:00

RFT3 from open to close took 08:30:00

So after all the task ticket is close, when it move to the review phase. I had a field total duration. which should show the total duration taken by all 3 task which in this example should be 8 day 11 hour and 30 min (8 11:30:00), I was able to calucalete the time different for each task, but I having problem summing up the duration.

Regards

Soong 

 

 

Regards
Soong
0 Likes
Highlighted
Regular Contributor.. Regular Contributor..
Regular Contributor..

Re: how to add two duration

Where are you summing it up? And from where are you updating? In other words, SM is communicating with which tool for computation and updates.

0 Likes
Highlighted
Super Contributor.. Super Contributor..
Super Contributor..

Re: how to add two duration

Hi,

I'm summing it up in a ruleset which i put in the entry of the review phase.

there is not tool, I just want the sum of total duration of all task in the request ticket

Regards

soong wengchew

Regards
Soong
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.