Thus far I have survived on scouring the internet for examples of code that closely resemble what I am trying to do. however, I have hit a roadblock, as I have yet to find this questions anywhere.
I am trying to create a GPA calculator and was able to easily formulate the code to calculate the GPA a few different ways. I have 40 numeric text fields and 40 dropdowns that correspond to each course a person can take. each numeric has enough room for 1 digit that denotes the number of credit hours the course is worth. each drop down has 6 options ( " ", "A", "B", "C", "D", and "<T>", the "<T>" is a transferred credit). A-D have specified values that correspond to GPA (4.0-1.0) and both the blank space and "<T>" have assigned values of 0.
I've tried using formcalc to just sum() all of the credit hours fields and then divide that number by the quality points i get from sum((#ofCreditHours1 * Grade1) + (#ofCreditHours2 * Grade2), .... etc )) This works great. I've also tried if statements that say
if(Grade1.rawValue ne 0) then
$ + CreditHours.rawValue;
to get the total credit hours to add up. unfortunately, however, this continuously adds the number of credit hours entered into the field over and over as many times as Grade1 is changed (as long as it isn't 0)
Now that there is enough of a background story, my point. I need for the calculation to basically ignore the number of credit hours entered for a course if either " " or "<T>" are selected, because transferred credits do no affect GPA and therefore should be removed from the calculation. However, I still need the number of credit hours entered for a course to be displayed.
I'm sorry if this was long or confusing or both, but I would appreciate any inspiration or solutions at all!
it may not need to be said, but just in case, if a grade selection is made that removes the credit hours from the total credit hours and then it is changed to "A"-"D", the credit hours need to count in the total again.
Also, I have these scripts running in the calculate event