Skip to main content
Marilyn999
Participant
September 14, 2018
Answered

Column totals automatically return specific words dependant on what the total is

  • September 14, 2018
  • 1 reply
  • 748 views

I have a two page pdf form where the user puts a tick in the appropriate box.  At the bottom of the form, the ticks in each column are added up.  This sub-total (sub-total_1) is then multiplied by a specific number (column 1 is by 1, column 2 is by 2, column 3 is by 3 and column 4 is by 4) to give sub-total_2.  Both sub-totals 1 and 2 are then added to give a final total for each column.  All four column totals are then added to give a final figure.  All of this works.

Based on the final total, I would like the form to automatically write:

Low if the total is between 0 and 20;

Moderate if the total is between 21 and 33;

High if the total is between 34 and 46;

Extreme if the total is 47 or more.

Is this possible and, if so, how do I do that?

I'm using Adobe Acrobat Pro DC, 2015

This topic has been closed for replies.
Correct answer try67

As the custom calculation script of the text field where you want to show the result, enter this code:

var total = Number(this.getField("Total").valueAsString);

if (total<=20) event.value = "Low";

else if (total<=33) event.value = "Moderate";

else if (total<=46) event.value = "High";

else event.value = "Extreme";

PS. The entire first paragraph of your question was not really necessary... It's better to keep things simple, to increase your chances of getting a reply.

1 reply

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
September 14, 2018

As the custom calculation script of the text field where you want to show the result, enter this code:

var total = Number(this.getField("Total").valueAsString);

if (total<=20) event.value = "Low";

else if (total<=33) event.value = "Moderate";

else if (total<=46) event.value = "High";

else event.value = "Extreme";

PS. The entire first paragraph of your question was not really necessary... It's better to keep things simple, to increase your chances of getting a reply.

Marilyn999
Participant
September 17, 2018

Thankyou for helping me. I entered your code as the custom calculation

script of the text field where I want to show the result and nothing

happened.

Inspiring
September 17, 2018

Check the JavaScript console for errors by pressing Ctrl+J.