• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

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

Explorer ,
Mar 01, 2019 Mar 01, 2019

Copy link to clipboard

Copied

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.

Capture.JPG

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!

TOPICS
Acrobat SDK and JavaScript , Windows

Views

466

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 01, 2019 Mar 01, 2019

Copy link to clipboard

Copied

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 PDFScripting
Use the Acrobat JavaScript Reference early and often

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 02, 2019 Mar 02, 2019

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 02, 2019 Mar 02, 2019

Copy link to clipboard

Copied

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 PDFScripting
Use the Acrobat JavaScript Reference early and often

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 02, 2019 Mar 02, 2019

Copy link to clipboard

Copied

Your problem is a lack of knowledge about how Acrobat fields and scripting work. If you want to learn more on this topic,

then see this site: pdfscripting.com

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 02, 2019 Mar 02, 2019

Copy link to clipboard

Copied

I tried different export values but I must have been doing something wrong because it didn't work for me.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 02, 2019 Mar 02, 2019

Copy link to clipboard

Copied

Here's an article that discussed how to setup RadioCheckboxes. 

https://acrobatusers.com/tutorials/creating-radio-checkboxes1

It's old (things haven't changed) and mostly about LiveCycle forms (ignore this part), but there is an example file that shows how it done.

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 02, 2019 Mar 02, 2019

Copy link to clipboard

Copied

LATEST

Thank you! I will check it out. I appreciate your willingness to help and your abundant knowledge. I've read a few of your articles

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines