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:
Monday | Place | Kilo. | Total Hours |
---|---|---|---|
+ - | City | 18 | 08:35 |
+ - | other city | 3 | 05:05 |
+ - | big city | 7 | 03:15 |
Totals | 28 km | 16:55 |
My question is how to calculate the big total time if he can add many row.
Thanks i'm very despair.
Views
Replies
Total Likes
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.
Views
Replies
Total Likes