## How to assign a number value to a letter

May 16, 2018

Copied

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

Views

179

Likes

Report

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

## How to assign a number value to a letter

May 16, 2018

Copied

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

Views

180

Likes

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
May 16, 2018 0
4 Replies 4
May 24, 2018

Copied

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;

}

Likes

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
May 24, 2018 0
May 25, 2018

Copied

Where would I enter the Javascript?

Likes

Report

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

Copied

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.

Likes

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
May 25, 2018 1
LATEST
May 25, 2018

Copied

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

Likes

Report

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