I'm trying to make a GPA calculator with different levels of classes, so like AP, Honors. For our school there's a weird system where each different class gets a different scorepoints that correlates to different grades but all have the same credit (5). However, I can't really figure out how to implement dictionaries into a specific procedure and get results. When I'm testing with only one subject,the results are always zero no matter how I change my original code. What should I do.
gpacalculator.aia (7.8 KB)
I would expect to see course names in dictionary keys.
What hieroglyphic language is that?
sorry, my bad.
wasn't paying attention.
I am a bit confused though since I've checked some of the codes I wrote and it seems like the credit is incorrectly labeled everytime when I input Chi, also, I can't seem to have a result for the global Calc_point_x_credit
heres an update, I can't seem to figure out the problems I have on the calculation on credits and the total gpa after calling back procedure
im trying to figure out what part is wrong with my codes, thats why theres only one course
apparently the credits here are also incorrect somehow

王俊夫,你这程序calulate那步可以直接用get global creditxgrade
then where do i call procedure
listpicker. Text 可以改成selection吗
There is a contradiction here:
The procedure expects global point_list to be a list of textbox components.
But the init global for point_list initializes it to a list with the text value of point_text1 at app startup.
The init global should be changed to
Notice how the component block has no attribute.
(I have not opened your new aia yet, so you might have more textboxes for the list.)
as a matter of fact, i haven't add more textbox
the logic here is confusing and i want to understand it completely before i add more
the problem still remains that my output of credit1 and calc_point_x_credit is wrong in someways i can't understand.
When I type in "CHI", the out put of credit1 is 5 and according to my code it should be 3 and somehow its not

There is also a problem here:
You extract a numeric grade from the current text box item, but then ignore it and try to do numeric comparisons against the list of textbox components point_list.
You should be comparing grade, not the list.
You also need another variable to hold the alphabetic grade, with a different variable name.
Think of different names for:
- the numerical grade
- The alphabetical grade.
(Maybe I just solved that for you?)
Regarding that List Picker TouchDown event, I have never seen it used in a decade of AI2 apps on this board.
I would move its code into the AfterPicking event, and delete the touchdown event.
P.S. It would be cleaner to keep a dictionary mapping course names into their credits.
that would be great if you solve it for me, thank you.
would it be easier if i just create a list for the credit of each course and apply it to each?
Here's a fix, draggable blocks.
I made the global variable name more descriptive, to avoid type confusion.
Table or dictionary lookup is generally simpler and more expandable than a ladder of if/then/elseifs.
It's your app, follow your desires.












