I am looking to create a calculated embedded data field that acts as a score/index for each looped through item in a loop and merge. See an example survey design below, where the respondent selects from a list of products to rate in the 1st block. The 2nd block then loops through each selected product with a series of 5 matrix statement questions.

For each selected product, I want to output an index to an embedded data field that is named “[selected product] - Index Score”. So if all 3 of the available products were selected and rated, then 3 index score embedded data fields would be generated on the response, with dynamic field names based on the current loop.
The scale labels then have scores assigned to them:
- Strongly disagree: 0
- Somewhat disagree: 1
- Neither agree nor disagree: 2
- Somewhat agree: 3
- Strongly agree: 4
To get the product’s index score, you sum up the scores from each question that was answered (excluding “Not applicable”), divide by (4 * # answered questions), and multiple by 100.
For each question where “Not applicable” was selected or a matrix statement was not answered, this should not result in a lower score. See an example response below and how the score would be calculated.


I tried using scoring to do this but that doesn’t work with looping questions. This could be done with extensive survey flow logic, but we have 50+ products in our survey to select from so it would not be efficient or easy to maintain. Does anyone have a JavaScript solution to this? This would need to work in the Simple/New Survey Taking Experience layout. Thank you!
