Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Mission!

Learn More

View all

Sign in to view all badges

# Adobe LiveCycle (Archived)

## calculate time of extensible row

lindsayg9092203
Level 1

Likes

0 likes

Total Posts

5 posts

Correct Reply

0 solutions
Top badges earned
View profile

lindsayg9092203
Level 1

Likes

0 likes

Total Posts

5 posts

Correct Reply

0 solutions
Top badges earned
View profile
lindsayg9092203
Level 1

14-05-2015

Hy!

Sorry for my English. I need help.

I have a problem to find a simple script to calculate the time [HH:MM].

I have a table where the client can add many row.

The last column is for the total time per day.

Here's an example:

MondayPlaceKilo.Total Hours
+  -City1808:35
+  -other city305:05
+  -big city703:15
Totals28 km16:55

My question is how to calculate the big total time if he can add many row.

Thanks i'm very despair.

#### Answers (1)

Salster123
Level 1

Like

1 like

Total Posts

8 posts

Correct Reply

1 solution
Top badges earned
View profile

Salster123
Level 1

Like

1 like

Total Posts

8 posts

Correct Reply

1 solution
Top badges earned
View profile
Salster123
Level 1

04-06-2015

Obviously I don't know what you have called your rows and fields, so replace relevant bits.
it will be something like this...

//get a reference for each of the rows
//repeating fields have the same name so have to use this to reference them

var allHours = xfa.resolveNodes("total_hours[*]");

//find out how many there are
//the underscore is instead of instance manager

var nNodesLength = _my_row.count;

//set the initial sums to be zero
var nSum = 0;

//now add them all up for each instance of the rows
for (var nNodeCount = 0; nNodeCount < nNodesLength; nNodeCount++) {
var item = allHours.item(nNodeCount);
//now add the hours
nSum += item.theHours.rawValue;
}

//put into your grand total field
grand_total_hours.rawValue = nSum;

Hope this is of some help.