Avatar

Correct answer by
Level 7

Hi Milly,

You haven't said what else is in the grade or what the possibilities are A+, B-, etc. AND whether these are in a table row. I will assume they are in a table. I would think about a drop-down box for the grade. That said, this could work for either a drop-down box or a text field containing the grade (depending on how you have the drop down box configured) or this script is easily modified for a drop-down box containing numeric item values in the "Binding" tab. This would lend itself to computing GPA (if that is an ultimate goal).

GradeCredit
A3
C3
F0
A3

The script is easy enough.

Make sure you place this on the calculate event of the "credit" field AND formCalc is the language :

////////////////////////////

     if     (grade < "F")      then

          $ = 3

     else

          $ = 0

     endif

////////////////////////////

if there are + or - grades you could use

////////////////////////////

     if     (Substr(grade,1,1)  <  "F")      then

          $ = 3

     else

          $ = 0

     endif

////////////////////////////

The: Substr(grade,1,1) extracts the 1st letter of the grade and uses that for the comparison

Substitute the name of your grade field for the "grade" above and you should be good to go.

Good luck,

Stephen

View solution in original post