Highlighted

Color Coded percentages

Explorer ,
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

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!

TOPICS
How to

Views

143

Likes

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

Color Coded percentages

Explorer ,
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

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!

TOPICS
How to

Views

144

Likes

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

Copy link to clipboard

Copied

Your code is working fine for me.

Did you check field calculation order?

Likes

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
Reply
Loading...
Sep 18, 2020 0
Explorer ,
Sep 18, 2020

Copy link to clipboard

Copied

No! I am not sure how to do that?

Likes

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
Reply
Loading...
Sep 18, 2020 0
Explorer ,
Sep 18, 2020

Copy link to clipboard

Copied

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

Likes

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
Reply
Loading...
Sep 18, 2020 0
Contributor ,
Sep 18, 2020

Copy link to clipboard

Copied

Can you share your file?

Likes

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
Reply
Loading...
Sep 18, 2020 0
Explorer ,
Sep 18, 2020

Copy link to clipboard

Copied

Yes. Note sample data, page 7.

Likes

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
Reply
Loading...
Sep 18, 2020 0
Contributor ,
Sep 18, 2020

Copy link to clipboard

Copied

Can't download.

Likes

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
Reply
Loading...
Sep 18, 2020 0
Explorer ,
Sep 18, 2020

Copy link to clipboard

Copied

This link

Likes

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
Reply
Loading...
Sep 18, 2020 0
Adobe Community Professional ,
Sep 18, 2020

Copy link to clipboard

Copied

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

Likes

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
Reply
Loading...
Sep 18, 2020 0
Explorer ,
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!

Likes

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
Reply
Loading...
Sep 18, 2020 0
Adobe Community Professional ,
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.

Likes

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
Reply
Loading...
Sep 18, 2020 0
Contributor ,
Sep 18, 2020

Copy link to clipboard

Copied

For me everything works fine.

Likes

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
Reply
Loading...
Sep 18, 2020 0
Explorer ,
Sep 18, 2020

Copy link to clipboard

Copied

Weird. I still get red cells

Likes

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
Reply
Loading...
Sep 18, 2020 0
Adobe Community Professional ,
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.

Likes

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
Reply
Loading...
Sep 18, 2020 0
Explorer ,
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

Likes

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
Reply
Loading...
Sep 18, 2020 0
Adobe Community Professional ,
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.

Likes

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
Reply
Loading...
Sep 18, 2020 0
Explorer ,
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?

 

Likes

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
Reply
Loading...
Sep 18, 2020 0
Explorer ,
Sep 18, 2020

Copy link to clipboard

Copied

because the 62.86 entered in the WorkKeys slot seems to work.

Likes

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
Reply
Loading...
Sep 18, 2020 0
Explorer ,
Sep 18, 2020

Copy link to clipboard

Copied

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!

Likes

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
Reply
Loading...
Sep 18, 2020 0