Copy link to clipboard
Copied
I have an enormous amount of calculated fields, and am trying to audit them to make sure everything is as it should be. It would be easiest for me if I could copy and paste the list into excel to better plan the hierarchy of the fields. Is there a way to print the field calculation order in the javascript console?
As an apology, I wrote the code that does it for you:
var fields = [];
for (var i=0; i<this.numFields; i++) {
var f = this.getField(this.getNthFieldName(i));
if (f==null) continue;
if (f.calcOrderIndex>=0) {
fields.push(f);
}
}
fields.sort(sortByCalcOrderIndex);
for (var i=0; i<fields.length; i++) {
console.println(fields.name);
}
function sortByCalcOrderIndex(a,b) {
return a.calcOrderIndex-b.calcOrderIndex;
}
Copy link to clipboard
Copied
Not possible with a script, no, unfortunately.
Copy link to clipboard
Copied
Yes it is.
You can loop through the fields adding each Field with a calcOrderIndex property greater than -1 to an array. Then use the Field Object calcOrderIndex to sort the fields based on the calcOrderIndex property, then print their names to the console.
If the calcOrderIndex = -1, it's not a calculated field.
Copy link to clipboard
Copied
Sorry, my mistake. I was thinking about the tab order.
Copy link to clipboard
Copied
As an apology, I wrote the code that does it for you:
var fields = [];
for (var i=0; i<this.numFields; i++) {
var f = this.getField(this.getNthFieldName(i));
if (f==null) continue;
if (f.calcOrderIndex>=0) {
fields.push(f);
}
}
fields.sort(sortByCalcOrderIndex);
for (var i=0; i<fields.length; i++) {
console.println(fields.name);
}
function sortByCalcOrderIndex(a,b) {
return a.calcOrderIndex-b.calcOrderIndex;
}
Copy link to clipboard
Copied
Oh! I just saw this- THANK YOU SO MUCH! This will save me so much time!
Thanks also to you Joel Geraci​!
Copy link to clipboard
Copied
If the tab order is unspecified, you can use the upper left coordinate of the field rect to determine tab order. Unfortunately, there is no way to determine what the Tab Order setting is for that particular page.
Copy link to clipboard
Copied
I really hope Adobe will implement a r/w tabOrderIndex property one of these days... It will save us form developers so much agony.
Copy link to clipboard
Copied
I just want a generic JavaScript COS walker so that we don't have to wait for Adobe to do anything except that.
Copy link to clipboard
Copied
One can always dream...
On Mon, Oct 9, 2017 at 10:56 PM, Joel_Geraci <forums_noreply@adobe.com>
Find more inspiration, events, and resources on the new Adobe Community
Explore Now