1 Reply Latest reply on Apr 6, 2011 5:15 AM by Mallard27

    Form Calculations

    csb102155 Level 1



      I'm rather new at using Adobe LiveCycle Designer and I have two books that I work with to help me with my forms design.  However, I am lost when it comes to getting rows of number fields to calculate.  I have a table that is set to expand (Add Row) if needed with an initial row count of 3, plus a total line.  2 of the 4 columns, I need to calculate.  They are the Original Amount and Final Amount Paid.  The users put in the numbers and then I need at the bottom for the form to do the calculations for the "Total" amount.


      Also, the owner of the form wants the Total to show on the first page regardless of how many rows there are so if the add row goes onto a second page, the total will still be on the first page.  Would putting that total row in the Master page be a good way to handle that?




        • 1. Re: Form Calculations



          The following example is using javascript in the script editor (there is a drop down for formcalc or javascript). Where you do the calculation is up to you but I am not sure I would put it on the master page; I would personally stick to the design view page.


          --------Below is the code-------


          var phrtotal = 0;

          for (i=0; i < form1.Analysis_Page_3.Analysis_Summary._Analysis.count; i++) {
              if (Analysis_Summary.resolveNode("Analysis[" + i + "].Proposed").rawValue) {
                 phrtotal = phrtotal + parseFloat(Analysis_Summary.resolveNode("Analysis[" + i + "].Proposed").rawValue);

          this.rawValue = parseFloat(phrtotal);


          ------above is the code-------

          You need to make sure you name the table something and the rows and cells something so that this is not confusing. Here are my values in the above code:


          Page Name: Analysis_Page_3

          Table Name: Analysis_Summary

          Row Name: Analysis

          Cell Name that I want to summarize: Proposed

          variable: phrtotal


          Simple put in your names into the above code and it should work for you. What I don't know is if having 3 rows initially will mess anything up or not; I would hope not but the table I have that also has "add row" capability is 1 row to start.


          I hope this works for you,