Use 'calculate' function to determine resulting points based on weighted answer options

Hello community,

I'm new to ODK, using ODK Build (in browser) and I'm creating an XLSForm that should be able to calculate the underlying values of 'choose one' - answer options (always 2,1 or 0) x 'weight field' (priority), store the results as 'points' in an extra field (- not necessarily shown, can be hidden) and give the final results at the end of the survey or a section.

How this can be done?

I know in the advanced-section of any question I can use 'calculate'. I would store the priority value (always changing) there or do the calculation directly there?

How to adress the values of the answer options with ${'data name of question'}?

Where to store the results and give the final result?

...and as an add-on:
Is it possible to 'colorize' a question, based on the answer option chosen (like 2,1,0 -> green, yellow, red)?

Thanks in advance for your support!

Yes this is almost certainly possible, but I'm a bit unclear on exactly where this (these?) weights come from. Could you perhaps give a couple of specific examples to clarify, and I'm sure we can come up with something.

si es posible hacerlo,
con el ejemplo mas especifico como lo dice @Xiphware será mucho más fácil ayudarte

Thanks for your responses. I will try to make my approach more clear with a screenshot...

So basically, this is an example of the excel sheet my ODK form should be based on.

Every row here represents a question which you find in box 1.
In box 2 we'll have the answer options in the ODK form:

  • Existing / fulfilled (2 points),
  • Partly existing / partly fulfilled (1 point),
  • Not existing / not fulfilled (0 points).

The box behind circle 2 shows the answer options and the corresponding colors:
2 = green, 1 = yellow, 0 = red

Circle 3 contains the weight field (priority) for every question and in circle 4 the calculation should be done which is:

  • answer option x priority

I want to know how to implement the calculation in my form and where to store the values.

Further on, I want to know if its possible to applicate the 'traffic light' in my form, so when answer option 'existing' is chosen the question or a box appears green and so on...

I hope the issue is more clear now.

Thanks in advance for your help, much appreciated...

There's a few different ways to accomplish this, but this is probably the simplest to understand. Have a look and play around with this (I've used weights of 5/10/15 to make it more obvious):

weightstotal.xlsx (9.8 KB)

when answer option 'existing' is chosen the question or a box appears green and so on...

Unfortunately I dont think dynamically reformatting widget colors according to user's input is possible.