Skip to main content
Known Participant
December 2, 2024
Question

Script for adding up numerous boxes across a document

  • December 2, 2024
  • 1 reply
  • 1077 views

Is there any way of writing a script which might help me do this?

 

I have 40-odd pages of boxes and checkboxes. The boxes are under 5 different headings, and 3 different colours. So, for example the headings are  A, B, C, D, E and the boxes themselves may be coloured green, blue or orange.

 

I want to create a calculation which adds up the following:

Green boxes under Headings A-E

Orange boxes under Headings A-E

Blue boxes under Headings A-E

 

I appreciate I can do a calculation and add the individual check boxes, but right now I need to do that on 2 different screens as I can't see the list of field names along the right hand side when i'm trying to add them to the calculation. So I have to keep checking them and going back. Is there a quicker way to do this at all please? Ideally, I'd be able to see the field names where they appear in the document when I am adding them to the calculation. (I should have added the heading and colour when I started putting in the field names, but I didn't and I really can't do the whole thing again!)

 

Thanks.

This topic has been closed for replies.

1 reply

try67
Community Expert
Community Expert
December 2, 2024

You can copy the fields names and then use the Simple Field Notation option under the Calculate tab to set up the sum, simply like this:

FieldA+FieldB+FieldC

etc.

However, if those field names contain a space you have to escape it, like this:

Field\ A+Field\ B+Field\ C

Known Participant
December 2, 2024

Thanks very much. I've managed to put all the fields into the script but it adds up to 10 and goes no further, even though there are many more tasks than that. I have put in the \ instead of a space and also tried the \ AND a space, to no avail.

 

Having done a search, I also have changed all words into lower case.

 

I get this error:

 

 

SyntaxError: missing ; before statement
1:Field:Calculate
SyntaxError: missing ; before statement
1:Field:Calculate
SyntaxError: missing ; before statement
1:Field:Calculate
SyntaxError: illegal character
1:
SyntaxError: illegal character
1:
SyntaxError: illegal character
1:
SyntaxError: missing ; before statement
1:Field:Calculate
SyntaxError: missing ; before statement
1:Field:Calculate
SyntaxError: missing ; before statement
1:Field:Calculate
SyntaxError: missing ; before statement
1:Field:Calculate

 

The calculation is:

field\trigger.0.0.0+field\trigger.0.1+field\trigger.0.2+field\trigger.0.3+field\trigger.0.5+field\trigger.0.0.1.1+field\trigger.0.0.1.3+field\trigger.0.0.1.4+field\trigger.0.pg7+field\trigger.0.27+field\trigger.0.57.1.0.1.0+field\trigger.0.57.1.0.1.5+field\trigger.0.10.1+field\trigger.0.10.5+field\trigger.0.10.0.1.1+field\trigger.0.10.0.1.0.1.1.0+field\trigger.0.13.1+field\trigger.0.14.0.1+field\trigger.0.14.0.5+field\trigger.0.15.0.0.3+field\trigger.0.16.0.3+field\trigger.17.0.1.3+field\trigger.0.18.3+field\trigger.0.19.01.3+field\trigger.0.20.01.0.1+field\trigger.0.21.01.0.0.0+field\trigger.0.22.0+field\trigger.0.23.0+field\trigger.0.24.0+field\trigger.0.24.5+field\trigger.0.25.4+field\trigger.0.26.4+field\trigger.0.0.28.1+field\trigger.0.0.29.1+field\trigger.0.0.30.0+field\trigger.0.0.30.3+field\trigger.0.0.31.2+field\trigger.0.0.31.4+field\trigger.0.32.3+field\trigger.0.33.0+field\trigger.0.0.34.+field\trigger.0.0.35.0+field\trigger.0.0.35.4+field\trigger.0.36.0+field\trigger.0.0.37.2

 

Thank you for any advice you can give!

try67
Community Expert
Community Expert
December 2, 2024

You're missing the actual spaces after the back-slashes.