Skip to main content
Lexi Rose
Participant
May 3, 2024
Question

Scripts for auto ranking in PDF Form?

  • May 3, 2024
  • 1 reply
  • 582 views

Hi, I'm just now learning how to add scripts to PDF Form calculations, so any help at all is greatly appreciated.  I've attached an example of what I'm trying to accomplish.  I have 3 simple division equations listed, and would like the user to input numbers (between 1 and 10) into each equation.  The PDF form would then calculate the quotient of each equation. I have been able to program that part, but it's the next 2 parts I'm not sure how to do -

I would then like the form to assess the 3 quotient values, and next to each one add a ranking number: 1, 2, or 3. (For the purpose of this exercise, the lowest number would receive the highest rank - #1)

Finally, I would like it to then populate a text line that puts the equation names in rank order: i.e. "Equation Name [rank1], Equation Name [rank2], Equation Name [rank3]"

Hopefully the attached PDF illustrates the example more simply than my description.  The top half shows what I'm trying to accomplish, and the bottom half is where I began to actually populate a Form. (As mentioned, I was able to populate the Quotient values, but am lost after that.) I have currently manually populated the rankings, but am hoping to automate it through a script.

Any help would be greatly appreciated!  Thank you!!

This topic has been closed for replies.

1 reply

Nesa Nurani
Community Expert
Community Expert
May 4, 2024

If you use simplified field notation for division, you will get an alert when the denominator field is empty or 0, so instead you should use a custom calculation script.

What should happen if two "Quotient" fields have the same value, how do you decide rank then?