Copy link to clipboard
Copied
I hope you can help with this issue.
I have created an assessment form with 12 rows that uses 4, 3, 2, 1, 0 radio buttons for rating.
What I wish is to total all those boxes with checks under Rating 4
a) Total all those boxes with check under Rating 4. Each check box would have a value of 4.
b) Total all those boxes with checks under Rating 3. Each check box would have a value of 3.
c) Total all those boxes with checks under Rating 2. Each check box would have a value of 2.
d) Total all those boxes with checks under Rating 1. Each check box would have a value of 1.
e) Total all those boxes with checks under Rating 0. Each check box would have a value of 0.
The result is placed on the Total (Row 11).
Example:
If Rating 4 of Rows 3, 6, and 9 are checked, the total would be 12
If Rating 3 of Rows 1, 2, 4, 5, and 7 are checked, the total would be 15
If Rating 2 of Rows 8 and 10 are checked, the total would be 4
Appreciate the help you can give. Thank you.
After the declaration of the fields array add either a semi-colon or a line-break:
"F02012"]
Thanks, good catch. I forgot to add semi-colon, to the script, but I had a line break, so it wasn't an error for me.
I added semi-colon to script above.
Copy link to clipboard
Copied
First remove calculations from all total fields you have, then use this in only one of the total fields as custom calculation script:
var total1 = 0,total2 = 0,total3 = 0,total4 = 0;
var fields = ["F02001","F02002","F02003","F02004","F02005","F02006","F02007","F02008","F02009","F02010","F02011","F02012"];
for(var i in fields){
if(this.getField(fields[i]).valueAsString == "1")total1+=1;
if(this.getField(fields[i]).valueAsString == "2")total2+=2;
if(this.getField(fields[i]).valueAsString == "3")total3+=3;
if(this.getField(fields[i]).valueAsString == "4")total4+=4;}
this.getField("F02013a").value = total4;
this.getField("F02013b").value = total3;
this.getField("F02013c").value = total2;
this.getField("F02013d").value = total1;
There is no point of calculating total of checkboxes with 0 since it will always be 0.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
I'm not getting any errors, did you try to copy/paste script?
Please post exactly the script you are trying to use or your file.
Copy link to clipboard
Copied
After the declaration of the fields array add either a semi-colon or a line-break:
"F02012"]
Copy link to clipboard
Copied
Thanks, good catch. I forgot to add semi-colon, to the script, but I had a line break, so it wasn't an error for me.
I added semi-colon to script above.
Copy link to clipboard
Copied
Thank you so much Nesa and Try69 for the help. Computation is now working perfectly.
Copy link to clipboard
Copied
67...