4 Replies Latest reply on Dec 21, 2009 9:33 AM by CarlVL123

    Mathematical Functions in a Table

    CarlVL123 Level 1

      I have a 6x1 table and in one of the cells I want to create a formula that multiplies two items together to form a total that automatically calculates as you enter in numbers. In this case it is multiplying the "Goal 1 Weight" by "Percentage Achieved" to acquire "Weighted Score"


      Later on in the form I will want to pull in the 6 weighted scores and sum them up as well.  I know this is poissible in either Java or FormCalc, thanks for any help!

        • 1. Re: Mathematical Functions in a Table
          Raghu Nagireddy Level 3



          Please check the attached updated pdf.

          java script placed under variable of the form.

          some more script place on each row fields exit of "Goal 1 Weight" and "Percentage Achieved".

          Hope this will help.




          • 2. Re: Mathematical Functions in a Table
            CarlVL123 Level 1


            Unfortunately something went wrong when you uploaded the file and it can not be opened, could you try it again or paste the Java script in the message and tell me where to insert it.

            • 3. Re: Mathematical Functions in a Table
              Raghu Nagireddy Level 3

              I am able to download and its working properly.


              If not please follow the below steps to get the same. I attached same file u can try, if still same problem send me ur email i will mail the same form.


              For first and last rows fields GW1, GWPercent exit events add this script.(because you stated fields are text type insted of numeric)

              if(form1.variables.js.validateInteger(GWPercent.rawValue) && form1.variables.js.validateInteger(GW1.rawValue))
              GWWeight.rawValue = (Number(GWPercent.rawValue) * Number(GW1.rawValue));

              For rest of the rows fields GW2, GWPercent exit events add this script.

              GWWeight.rawValue = (GWPercent.rawValue * GW2.rawValue);

              To get total of all rows Weighted Score can call the below function on form ready event

              function calcTotal(){

              form1.SubformAllDocument.SubFormValues.NumericField1.rawValue =
                   Number(form1.SubformAllDocument.SubformRatings.Table1Scores.Row1.GWWeight.rawValue) +
                  form1.SubformAllDocument.SubformRatings.Table2Scores.Row1.GWWeight.rawValue +
                  form1.SubformAllDocument.SubformRatings.Table3Scores.Row1.GWWeight.rawValue +
                  form1.SubformAllDocument.SubformRatings.Table4Scores.Row1.GWWeight.rawValue +
                  form1.SubformAllDocument.SubformRatings.Table5Scores.Row1.GWWeight.rawValue +

              helper methds

              function isEmpty(str) {
              if(str == null || str.length == 0) {
                return true;
              return false;

              function validateInteger( strValue ) {
              var objRegExp  = /^\d+$/;
              return objRegExp.test(strValue);




              1 person found this helpful
              • 4. Re: Mathematical Functions in a Table
                CarlVL123 Level 1

                Is it easier to change the table parts to a numeric field?  Simplifying would be a good thing.