25 Replies Latest reply on Jun 30, 2009 7:03 AM by MarcelBoucher

    Calculate page subtotals in repeating dynamic subform

    ebb01983

      Hello,

       

      I have a repeating subform that can span many pages, at the bottom of the list I have a grand total.......thats great

       

      I would like to add a subtotal for each page of the repeating subform. How can I do this?

       

      I have the following code for my grand total:

       

       

      // Acquire all "Amount" Fields there are inside a subform

      var

       

      flds = xfa.form.form1.resolveNodes("$form.form1.table1_rows[*].tvos_t1");

      // Loop over list of fields and add up values

      var

       

      sum = 0;

      for

       

      (var i=0;i<flds.length;i++)

      {

       

      // Test fields value to make sure it is a number before

       

      // including it in the Sum

       

      if(!isNaN(flds.item(i).rawValue))

      sum

      += flds.item(i).rawValue;

      }

      // Ensure that "sum" is the last value run in the script

      sum;

       

       


      I guess I will need some pagination settings as well,

       

      all help hugely appreciated!