Skip to main content
Marilyn999
Participant
Sep 14, 2018 2:42 AM UTC
Answered

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

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 is closed to new replies. Start a new post to keep the conversation going.
try67
try67Correct answer
Community Expert
Sep 14, 2018 8:18 AM UTC

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.

4 replies

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
Sep 14, 2018 8:18 AM UTC

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.

Translate
Marilyn999
Participant
Sep 17, 2018 2:14 AM UTC

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.

Translate
Inspiring
Sep 17, 2018 3:41 AM UTC

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

Translate