1 Reply Latest reply on May 11, 2015 3:23 PM by gkaiseril

    Convert Calculated Sum Into A Letter Grade


      I have a text box that is already set to calculate a sum. Simple enough. But Instead of a number I want it show a letter grade. Such as 0=A 1=B etc. Is there a way to do this?


      Here are the conversions I want to have happen:

      0 = A

      1 = B

      2 = C

      3 = C-

      4 = D

      5 = D-

      6 = F

        • 1. Re: Convert Calculated Sum Into A Letter Grade
          gkaiseril MVP & Adobe Community Professional

          You can use the "if else" statement, the switch statement or lookup the value in an array.


          Will the field for the sum result in the letter grade?


          If you sum field is names "Score" then the custom calculation for a text field named "Grade" could have a custom JavaScript calculation of:


          var nScore = this.getField("Score").valueAsString;

          event.value = "";

          if(nScore != "" && nScore < 7) {

          var aGrade = new Array("A", "B", "C", "C-", "D", "D-", "F");

          event.value = aGrade[nScore];