Using Multiple If Else

Hey so what I’m trying to do is a little bit complex hope you can help me out
So I have 7 field boxes, each with a grade A B C D E S or U which a user can select through a dropdown. So each of the 7 fieldnames have 7 Grade options a user can select which will then be calculated as a fixed Rank Grade in the final sum as I need to add the points of all 7 fieldboxes into a final calculated box.
Now I did think of creating a function, but that would only be useful for a single field box with multiple returns
(function(){
if(fieldname15 == ‘A’) return 20;
if(fieldname15 == ‘B’) return 17.5;
if(fieldname15 == ‘C’) return 15;
if(fieldname15 == ‘D’) return 12.5;
if(fieldname15 == ‘E’) return 10;
if(fieldname15 == ‘S’) return 5;
if(fieldname15 == ‘U’) return 0;
return 1;
})();`So the only option I have is to create 7 IF statements for each of the 7 fields which would total to 49 lines of code, as shown above
I was hoping there would be an efficient way to tackle this? Like maybe a parameter for the function so I could just send a fieldname into a function and get a grade/mark outAlso how do you assign the value of a function return to a fielddbox? The documentation has missed that part out`
 You must be logged in to reply to this topic.