0 Replies Latest reply on May 12, 2016 4:24 AM by ianm863305

    How to calculate man hours in repeating table?

    ianm863305 Level 1

      I'm working with LiveCycle ES3.


      I have a table that repeats using the built in button of ADD, REMOVE, UP and DOWN. Inside a column of the table I have another table that consists of 4 rows. All are time Fields StartTime, TimeField2, EndTime, and total. I don't need anything to happen with Time Field2. What I would like to see is the total field calculate the total man hours it took to complete that particular job. In addition there is a Checkbox that locks every field in the repeating table except the add button. This is to be used a log book for a fire department and needs to stay and be un editable once inputted. I'm using the following script in the calculate event for the total field. It works great until I save the form and check to box to lock out all the fields. I then get 0:18 in the total field and if I try and add more tables I get a NaN:NaN in the first table and nothing in the rest.


      Hers the script I'm using



      vTime1 = Row1.StartTime.rawValue;

      vTime2 = xfa.resolveNode("Row3[0].EndTime").rawValue;

      (vTime1.length == 4 && vTime2.length == 4) {

      vTime1Minutes = parseInt(vTime1.substring(0, 1))*600 + parseInt(vTime1.substring(1, 2))*60 + parseInt(vTime1.substring(2, 4));



      var vTime2Minutes = parseInt(vTime2.substring(0, 1))*600 + parseInt(vTime2.substring(1, 2))*60 + parseInt(vTime2.substring(2, 4));


      if (vTime1Minutes > vTime2Minutes)


      vTime1 = vTime2Minutes+1440 - vTime1Minutes;




      vTime1 = vTime2Minutes - vTime1Minutes;



      var Hours = Math.floor(vTime1/60);


      var Minutes = vTime1%60;


      if (Minutes < 10)


      Minutes = "0" + Minutes;


      this.rawValue = Hours + ":" + Minutes;


      Any and all help on this matter would be greatly appreciated!