1 Reply Latest reply on May 4, 2016 9:22 AM by gkaiseril

    custom calculation script to add two fields and show the result in a third field only if user enters data into one or both of the 1st two fields

    tammys21400643

      I'm trying to write a script that will calculate the sum of two field if there is a value entered into one or both of the fields. So far, the custom calculation in the third field looks like this:

       

          var c2 = this.getField(“Cargo WeightRow2”).value;

          var t2 = this.getField(“Tare WeightRow2”).value;

       

          if(c2 == “ ”) && (t2 == “ ”)

          event.value = c2 + t2;

          else if(c2 == “ ”) || (t2 == “ ”)

          event.value = c2 + t2;

          else if(c2 = “ ”) && (t2 = “ ”)

       

       

      However, I want the user to be able to manually enter a value into the third field if both of the other fields are empty. Please help.