Copy link to clipboard
Copied
Hello, I have created a score form having check boxes. I can easily calculate total score by assigning values 1 2 3 to check boxes and by giving same names in same row to the check boxes.
But how is this possible to calculate sub total score of each column separately. See picture
Copy link to clipboard
Copied
You should structure the naming rule by column, as in this example that you should examine: https://documentcloud.adobe.com/link/track?uri=urn:aaid:scds:US:1c732995-09a8-4dc3-ab3b-661aa1d3f1ab
Copy link to clipboard
Copied
These look like Radio button groups. If this is true, then a script won't be able to identify the individual column fields by name. Instead you'll the script will need to count selected values.
For example, lets say the radio button groups are named "Score1" thorough "Score10". The calculation script for the 0 column total would be this:
var nSum = 0, oFld;
for(var i=1;i<=10 ;i++)
{
oFld = this.getField("Score" + i);
if(oFld.value == 0) nSum++;
}
event.value = nSum;
Copy link to clipboard
Copied
Copy link to clipboard
Copied
What are the names of radio button groups?
Do you want to show all results in one field?
Copy link to clipboard
Copied
I would suggest that you first prefix the names of the radio button groups with a "group name". For example if the radio button groups are named "Question1", "Question2", etc. Then change them to "Assesment.Question1", "Assesment.Question2", etc.
Then if the export value of all choice 1's is "1", this code will create a sum for choice 1
Place this code in the custom calculation script of the field where the total for choice 1 will be shown.
var aQuestionList = this.getField("Assesment").getArray();
var nSum = 0;
for(var i=0;i<aQuestionList.length;i++)
{
if(aQuestionList[i].valueAsString == "1")
nSum++;
}
event.value = nSum;