Copy link to clipboard
Copied
I'm trying to have the last row of my PDF display a ranking of 1st - 4th based on the scores of the fields in the row directly above this row. I'm very new to using Adobe Acrobat Pro but was able to get automation for sum totals and averaging them in the other fields at the bottom of this document, I'm just hung up on scripting a rule to rank those fields. This is for completing Functional Behavioral Assessments in an educational setting. Thanks for any help offered.
Here's a ranking sample I found on SO. You would collect the 4 field values in an array and rank them using function below. You would get a ranked array back.
// https://stackoverflow.com/questions/14834571/ranking-array-elements
var arr = [30, 23, 21, 45];
rankings (arr); // Result: 2,3,4,1
function rankings(arr) {
var rankingsArr = [];
for (var i = 0; i < arr.length; i++) {
var rank = 1;
for (var j = 0; j < arr.length; j++) {
if (arr[j] > arr[i]) rank++
...
Copy link to clipboard
Copied
Here's a ranking sample I found on SO. You would collect the 4 field values in an array and rank them using function below. You would get a ranked array back.
// https://stackoverflow.com/questions/14834571/ranking-array-elements
var arr = [30, 23, 21, 45];
rankings (arr); // Result: 2,3,4,1
function rankings(arr) {
var rankingsArr = [];
for (var i = 0; i < arr.length; i++) {
var rank = 1;
for (var j = 0; j < arr.length; j++) {
if (arr[j] > arr[i]) rank++;
}
rankingsArr.push(rank);
}
return rankingsArr;
}
Copy link to clipboard
Copied
I wish that made it make more sense... I'm guessing I can't just copy and paste this into the Custom calculation script box in the field properties and it'll magically work...
Copy link to clipboard
Copied
Can you provide a sample file for testing? I don't know Acrobat Javascript from memory as much as I do Illustrator.
Copy link to clipboard
Copied
but to answer your question, no it would not magically work if you copy and paste it.
this line represents the 4 field values you'll have to collect first
var arr = [30, 23, 21, 45];
Copy link to clipboard
Copied
As far as I can see, your question is related to Acrobat Pro, isn't it?
If so, you may want to ask in the Acrobat forum instead of the Illustrator forum.