Thanks for posting.
Tried "rounding" in both the field that calculated the fractional part of an hour and the conversion to minutes, both as calculations and part as validations. The final calculated field that must be rounded - the number field that is summed in the total minutes - still carries the decimal amounts.
Need to do more work on which calculation to use in what combination for which result.
The image I posted shows all fields in use - of course, a number of those fields will be hidden in the final product.
The total is not required to be a key element in any financial calculations. It is a simple total and averaging of minutes a first person arriving at a bus stop must wait to board an employee transport. The averages are submitted to the contracted carrier and are not exact, except the sum of the minutes on a sheet can't be more than the actual figures shown. If the hand calculation equals 42 minutes <example> then the form calculation must equal 42 minutes, not 43 or 44.
Just finished an inspection form and a badge inspection security report. Back to this is a few days.
Thanks again.
I was requested to keep both fractions as well as rounding to closest minute. What I did:
Created one field formatted as a number, with 2 decimals. This field calculated the Time entry fields for elapsed time in minutes. Gives a percentage of an hour (did not try to carry beyond 1 hour - not required). Calculation:
var cIn = "In1", cOut = "Out1";
event.value = TimeDiff("HH:MM", cIn, cOut);
// convert zero entry to null
if(event.value == 0) event.value = "";
In and Out times through 9 entries.
Assigned an arbitrary name: "worked1" [Subsequent fields as "worked2", etc.]
Result of calculation: Example: 12:20 in, 13:00 out = .67 hour
Created a field to convert to minutes with fractions.
Named: "minute1"
Format: None
Calculation (product): 60, [field] worked1
Result: .67 hour = 40.2 (the fraction that drives one crazy)
Field for rounding out fractional values.
Named: "Sum1" ("Sum2", etc. for a total of 9 calculations)
Format: None
Calculation:
event.value = this.getField("minute1").value;
event.value = Math.round((event.value*100)/100) ;
[There is an example of Math.round on net, but posted incorrectly as "event..value"]
Tested through every full minute entry against out and result is valid.
A Total of the Sum fields gives the correct total.
Average time is calculated against a number field (1 for each bus arrival) x Total.
Did not use a group name (In.1, In.2, etc, then calculating on "In").
Thanks to all who visited and offered suggestions.