Skip to main content
Known Participant
March 1, 2019
Question

How do I reset a calculated field or create two possible sums in the same field?

  • March 1, 2019
  • 1 reply
  • 1174 views

I have done so much searching that my mind is turning to mush, so I hope what I am about to ask makes sense.

Here is the form I am working with.

As you can probably guess, I am adding everything from contracted hours to fully licensed into the total pay rate at the bottom. All of these fields have values that are calculated based on other actions/entries. Now, I have been asked to include a place for a negotiated rate that people can type in their own answer, but I still need this rate to calculate in the total pay rate without adding to the originally contracted rate. Does that make sense?

I need one of two things to happen:

Either when the negotiated base box is checked, the contracted hours (45) becomes zero. Or when I add the percentages, I can somehow eliminate the value of the base rate if there is a value in the negotiated rate.

Thank you for any help!

This topic has been closed for replies.

1 reply

Thom Parker
Community Expert
March 1, 2019

The best way to ask a complicated question is to simplify it. Cut away all the stuff around it until you are left with the essence of what you are trying to do.  It helps us a lot cause we don't know anything about your particular form.

You're explanation is not clear. But here are some tips.

1) A field can only have a single value.

2) Any number of conditions can be used to calculate the value, but the conditions must make sense.

3) A field value can be overridden by a manual entry. But there have to be clear conditions for doing so. 

So the first thing to do is to write down all the conditions and the results of each set of conditions.

Make sure they are consistent and do not work against each other. And that there is no guessing.

Here's an article on conditional JavaScript calculations:

https://acrobatusers.com/tutorials/conditional-execution

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
Known Participant
March 2, 2019

Thanks! I simplified my problem like you suggested and resorted to using two checkboxes. If box A is checked, field A appears. If box b is checked, field B appears. This solved my calculation problems, too.  The only thing I wish I could do but couldn't figure out how is to only allow one button to be checked at a time but allow different boxes to show as a result of which box was checked.  I tried several different scripts to attempt to use this on radio buttons but either I was doing something wrong or it just doesn't work.

Thom Parker
Community Expert
March 2, 2019

If you give a group of checkboxes the same name, and different export values, they will act just like radio buttons, i.e. only one can be checked at a time.

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often