6 Replies Latest reply on Apr 19, 2016 7:13 AM by Coleen77

    Script code adjustment request

    Coleen77

      I would like some help with adjusting this script in our custom calculation field:

       

      // Get the field values, as numbers

      var Goals = +getField("Goals").value;

      var GA1 = +getField("GA1").value;

      var GB1 = +getField("GB1").value;

      var GC1 = +getField("GC1").value;

      var GD1 = +getField("GD1").value;

       

      // Set this field value

      switch (Goals) {

      case 1:

          event.value = GA1;

          break;

      case 2:

          event.value = (GA1 + GB1) / 2;

          break;

      case 3:

          event.value = (GA1 + GB1 + GC1) / 3;

          break;

      case 4:

          event.value = (GA1 + GB1 + GC1 + GD1) / 4;

          break;

      default:

          event.value = "";

          break;

      }

       

      It was written when our form's "Goals" had the numbers 1 through 4 as options.  Now we have 0 through 4 as options - so shouldn't there be a "case 0" added to this? 

       

      Thank you for any help you can give.