Skip to main content
Known Participant
June 4, 2025
Answered

tickbox weight automation

  • June 4, 2025
  • 2 replies
  • 2730 views

ive got a document with automated weight fields. So when the net weight gets filled at the bottom it adds it to the top two net weights as shown by the arrows.

 

what i am trying to do is code so that if the pallete tickbox is ticked it only fills in the left hand net weight with the net weight. 

 

if the box is instead ticked it only fills out the net weight in the right hand net weight. as currently it fills in box left and right hand net weights. 

 

hopefully this makes sense. if not feel free to ask me any questions id be happy to answer them.

Correct answer try67

sure. here you go i attatched the file. thanks for the help i really appreciate it. 


You placed the code in the wrong location. It needs to go under the Calculate event of the Net Weight field, replacing what you currently have there. Also, you need to duplicate (and modify the field name in it) this line for each of the fields you want to add up:

total+=Number(this.getField("Weight1").valueAsString);

 

2 replies

try67
Community Expert
June 4, 2025

What should happen if both boxes are ticked?

And what are the names of the fields involved?

Known Participant
June 4, 2025

i would like if both boxes are ticked then both net weights to be filled in. if one tickbox is ticked i only want one net weights to be filled in.  if that makes sense?

 

so if the pallete tick box is ticked i would like the pallete net weight to be calculated.

 

if the box tickbox is ticked i would like the box net weight only to be calculated 

 

if box tick boxes are ticked i would like both net weights to be calculated by weight like this 

 

hopefully this makes sense and you can guage what i am trying to do here haha. 

try67
try67Correct answer
Community Expert
June 5, 2025

sure. here you go i attatched the file. thanks for the help i really appreciate it. 


You placed the code in the wrong location. It needs to go under the Calculate event of the Net Weight field, replacing what you currently have there. Also, you need to duplicate (and modify the field name in it) this line for each of the fields you want to add up:

total+=Number(this.getField("Weight1").valueAsString);

 

Nesa Nurani
Community Expert
June 4, 2025

Do you use script to fill those two fields, if yes what is it?
What is the name of the checkbox and weight fields?

Known Participant
June 4, 2025

i dont use a script. i just use the sum + then select all of the weight fields i want to calculate.

 

also these are the names of all the fields you should need. 

try67
Community Expert
June 4, 2025

The field names are not fully visible. Please post them as text. Also, I thought the fields were just supposed to show the value of a single field, but in the screenshot it appears to be the sum of multiple ones...