Copy link to clipboard
Copied
I have a page with a grid of checkboxes -- columns and rows.
I'd like a field to the right of the row that gives me just a total of the number of checkboxes checked across the row (checkbox1, checkbox2, checkbox3, checkbox4, checkbox5).
I realize if I want to total up the row's checked boxes the calculation would be the same as if I checked a column's checkboxes, the only difference being how I indicate which fields are being counted conditionally.
Anyone that can help me with this?
Thanks in advance!
1 Correct answer
I figured this out. I solved it by making sure each checkbox had a different exported value other than "Yes". I gave them the exported value of 1.
Then I had a text field at the end of the row, and at the bottom of the column, that calculated the sum of the corresponding checkbox fields for that row or column.
Copy link to clipboard
Copied
An easy way to count checked checkboxes is to name them so that the checkbox names can be automatically found from the name of the total field. Then a generic script can be written to automatically generate the names.
For example "Row1_Col1" "Row1_Col2" "Row1_Col3" .... "Row1_Total"
Do you have any scripting experience?
These are also called table calculations. Serarch for this word on the forum and you'll find other threads that discuss specific code.
You can read more about general form scripting. Watch the video on Field Naming:
https://www.pdfscripting.com/public/PDF-Form-Scripting.cfm
Use the Acrobat JavaScript Reference early and often
Copy link to clipboard
Copied
I was logged in with the wrong account when I posted this originally. Replying here with my proper account.
I have limited experience with scripting so I didn't understand your reply, but maybe I should have been a little more clear with my post to begin with. My table ONLY has checkboxes, no fields with numbers. Here's how it looks:
In that column to the far right, I want to put a numeric field that simply tells me how many boxes were checked across the cooresponding row. Not sure this changes your suggestion to me...
Copy link to clipboard
Copied
I figured this out. I solved it by making sure each checkbox had a different exported value other than "Yes". I gave them the exported value of 1.
Then I had a text field at the end of the row, and at the bottom of the column, that calculated the sum of the corresponding checkbox fields for that row or column.

