Skip to main content
Participant
January 30, 2020
Question

Conditional Calculations

  • January 30, 2020
  • 2 replies
  • 335 views

I am creating a survey form that has a series of multiple choice questions, A,B,C,D. Each question will have a specific value associated, i.e A is 5 points, B is 10 point, etc. Each section will have a sub-toal and then at the end there will be a grand total.

 

How do I retrieve the value associated with each response and then apply it to a sub-total field and grand total field?

This topic has been closed for replies.

2 replies

try67
Community Expert
Community Expert
January 30, 2020

If you're using a check-box, radio-button or drop-down field you can apply those values as the export values (or "radio button choice" values) of your fields, which means you could use them directly in your calculations.

Thom Parker
Community Expert
Community Expert
January 30, 2020

Here are some articles on Calculations:

https://acrobatusers.com/tutorials/how-to-do-not-so-simple-form-calculations/

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

https://www.pdfscripting.com/public/Calculating-field-values-and-more.cfm

 

For your situation, the radio buttons should export the point values, so they can be added directly. 

Each Radiobutton should have an extra hidden button with an export value of 0. This needs to be the default value for the group. 

Now the subtotal and total calculations can use simplified notation, because the output of the radio button values will always be a number.  

 

 

 

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