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

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

New Here ,
Sep 13, 2018 Sep 13, 2018

Copy link to clipboard

Copied

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

TOPICS
Acrobat SDK and JavaScript , Windows

Views

405

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

correct answers 1 Correct answer

Community Expert , Sep 14, 2018 Sep 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.

Votes

Translate

Translate
Community Expert ,
Sep 14, 2018 Sep 14, 2018

Copy link to clipboard

Copied

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.

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
New Here ,
Sep 16, 2018 Sep 16, 2018

Copy link to clipboard

Copied

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.

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
LEGEND ,
Sep 16, 2018 Sep 16, 2018

Copy link to clipboard

Copied

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

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
New Here ,
Sep 16, 2018 Sep 16, 2018

Copy link to clipboard

Copied

LATEST

Turns out I had an upper case letter where it should have been lower case! (in the field name)

Thankyou so much to both of you for helping 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