Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

How to assign a number value to a letter

New Here ,
May 16, 2018 May 16, 2018

I am trying to create a GPA calculator, so I want to assign a number value to letters. For ex. A=4, B=3, C=2, D=1, and F=0.

I will then multiple the credit hours by the letter. For ex. 3 x B = 9.

I understand how to do the calculations in the cells, but what I need help with is assigning a number value to the letters before completing a calculation.

Thanks.

TOPICS
Acrobat SDK and JavaScript
816
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
May 24, 2018 May 24, 2018

var v = this.getField("Score").value;

if (v=="") event.value = "";

else {

     if (v=="A") event.value = 4;

     else if (v=="B") event.value = 3;

     else if (v=="C") event.value = 2;

     else if (v=="D") event.value = 1;

     else if (v=="F") event.value = 0;

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 25, 2018 May 25, 2018

Where would I enter the Javascript?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 25, 2018 May 25, 2018

Using a drop down field for each course and using the Grade letter for the Item and assigning the weighting or number value to the Option would then cause the value of the drop down field to be the numeric value when the letter grade was selected. You can then use any of the filed calculation options to calculate the average.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 25, 2018 May 25, 2018
LATEST

gkaiseril​ This helped a lot! Got everything I need! Thank you!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines