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

Color Coded percentages

Explorer ,
Sep 18, 2020 Sep 18, 2020

Copy link to clipboard

Copied

Trying to make cells change color based upon a percentage using validation script in Adobe Acrobat Pro DC. The text field is a calculated value from other text fields in simplified field notation (i.e. Text42/Text44). 

Custom Validation Script:

var v = Number(event.value);
v = v.toFixed(2);

if (v<=0.55){event.target.fillColor = color.red;}else if (v>0.55 && v<=0.70){event.target.fillColor = color.magenta;}else if (v>0.70 && v<=0.84){event.target.fillColor = color.green;}else{event.target.fillColor = color.cyan;}

 

unfortunately, the calculated values all return red. (i.e. 0.94375 gives me a red background).

Any help would be greatly appreciated.

RB

TOPICS
How to

Views

942

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

Explorer , Sep 18, 2020 Sep 18, 2020

Got it. I had to change every cell that was used to calculate Text42 and change it back. I couldn't just retype the numbers to update. thank you both for helping me trouble shoot!

Votes

Translate

Translate
Community Expert ,
Sep 18, 2020 Sep 18, 2020

Copy link to clipboard

Copied

Your code is working fine for me.

Did you check field calculation order?

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 ,
Sep 18, 2020 Sep 18, 2020

Copy link to clipboard

Copied

No! I am not sure how to do that?

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 ,
Sep 18, 2020 Sep 18, 2020

Copy link to clipboard

Copied

I found it, however, after ensuring the order. I am still getting red.

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
Enthusiast ,
Sep 18, 2020 Sep 18, 2020

Copy link to clipboard

Copied

Can you share your file?

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 ,
Sep 18, 2020 Sep 18, 2020

Copy link to clipboard

Copied

Yes. Note sample data, page 7.

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
Enthusiast ,
Sep 18, 2020 Sep 18, 2020

Copy link to clipboard

Copied

Can't download.

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 ,
Sep 18, 2020 Sep 18, 2020

Copy link to clipboard

Copied

This link

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 18, 2020 Sep 18, 2020

Copy link to clipboard

Copied

As a test, try getting rid of that second line of code.

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 ,
Sep 18, 2020 Sep 18, 2020

Copy link to clipboard

Copied

I actually just added that as a potential fix. It didn't work before either. thank you though!

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 18, 2020 Sep 18, 2020

Copy link to clipboard

Copied

A validation script is triggered when the field value changes, so be sure to change the field value to trigger the code.

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
Enthusiast ,
Sep 18, 2020 Sep 18, 2020

Copy link to clipboard

Copied

For me everything works fine.

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 ,
Sep 18, 2020 Sep 18, 2020

Copy link to clipboard

Copied

Weird. I still get red cells

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 18, 2020 Sep 18, 2020

Copy link to clipboard

Copied

Check the JavaScript console (Ctrl+J) to see if any errors are reported. Also, try saving the file, closing Acrobat, and reopening to see if it makes a difference.

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 ,
Sep 18, 2020 Sep 18, 2020

Copy link to clipboard

Copied

video  

 

See above clip. And I notice that 8.57% returns cyan. I am at a loss

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 18, 2020 Sep 18, 2020

Copy link to clipboard

Copied

While "8.57%" results in cyan, a value of 8.57 results in red. That's a hint.

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 ,
Sep 18, 2020 Sep 18, 2020

Copy link to clipboard

Copied

I did find that. When you tested Asim, did you enter raw numbers, or did you use the calculated percentages?

 

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 ,
Sep 18, 2020 Sep 18, 2020

Copy link to clipboard

Copied

because the 62.86 entered in the WorkKeys slot seems to 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
Explorer ,
Sep 18, 2020 Sep 18, 2020

Copy link to clipboard

Copied

LATEST

Got it. I had to change every cell that was used to calculate Text42 and change it back. I couldn't just retype the numbers to update. thank you both for helping me trouble shoot!

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