Create score from checkboxes with different values


BACKGROUND: I'm still quite new to AppInventor and its coding but I have realised that my experience with coding html and CSS does help my learning process. I am planning a very simple app and with "simple" I mean that it is supposed to work as a finished notebook containing notes about important things that I might need to know in a certain situation but can't instantly remember.
There will be almost no input from the user, it will mostly just display text and images. The only input will not need to be saved in a database for later use, the data is just used there and then.

One of these input functions of the app is that I want to be able to count the GCS-score - a score that evaulates a persons level of consciousness by looking at eye, verbal and motor response to painful stimuli. Each category has 4-6 options and they are worth 1-6 points. You calcualte the score by adding the points from respective category for example Eyes 2p, Verbal 3p and Motor 4 p => GSC-score is 9 (yes - it's easy head counting, but I still want the function).

CURRENT PROBLEM: My first challenge was to make sure that the user only can check one checkbox in each category and that if you change to another checkbox within a category the first one is unchecked.
When it comes to calculating the score - I just can´t make it work. The complicating factor is that the checkboxes have different values. Otherwise I might have been able to use something like this although I still have three different categories that make upp the total score.
I've tried some coding but don't know how to generalise the checkboxes that are worth the same. Moreover, the "change"-control just makes the app add more and more to the score regardless of me checking or unchecking the boxes.
Here you can se parts of the list of checkboxes and the finished code + som boxes I have just messed around with.

Does anyone have any suggestions?

Sincerely Elin

This looks like a menu selection, weighting, and summation problem.

Here is a slightly similar data driven sample ...

1 Like