8 Replies Latest reply on Jul 16, 2012 1:49 PM by SBRCA

    Dynamic Table with repeating Subform




      I am maiking a form which has a Dynamic Table with a repeating Subform.  The repeating subform has a dropdown list field which has three options for the user to pic.  "LABOR", "EQUIPT.", & "MATL."



      The way I want the form to work is the user will choose which item they want to add to the form with the dropdown list.  Whatever amount they put into the "Amount" column will go to the corresponding total "LABORTotal", "EQUIPTTotal", & "MATLTotal"


      The repeating Subform is basically the Row1, but I have the table split up into subforms because of issues I had eariler with the form.  The repeating subform title is "detail". 


      I cannot get the sums for the 3 items to go into the corresponding totals field.  This is the script that I have for the labor total field:


      form1.total.LABORTotal::calculate - (JavaScript, client)

      var nAmount = xfa.resolveNodes("detail[*].Table1.Row1.AMOUNT");

      var nItem = xfa.resolveNodes("detail[*].Table1.Row1.ITEM");

      var nSum = 0;


      for (var i=0; i<nAmount.length; i++)


          if (nItem.item[i].rawValue == "LABOR")


          nSum = nSum + nAmount.item(i).rawValue;



      This.rawValue = nSum;


      I am not familiar with loop scripting or var scripting so I know I am getting it wrong somewhere. 


      I would greatly appreciate any help!