Copy link to clipboard
Copied
Here is the DLJ (Document Level Javascript) I want to convert to a script in a field in the document:
function getRanksValue(doc, name) {
var rank = doc.getField(name).value;
var value = 0;
if (rank < 1) {
value = -25;
} else if (rank > 20) {
value = 10 * 5 + 10 * 2 + (rank - 20);
} else if (rank > 10) {
value = 10 * 5 + (rank - 10) * 2;
} else {
value = rank * 5;
} return value;
}
The following is the script in a "Consolidated Script" field, where line 2 has the script that calls that DLJ:
for (var i=0;i<115;i++)
this.getField("Rank Bns."+i).value = getRanksValue(this, "Ranks"+i);
for (var ii=0;ii<115;ii++)
this.getField("Total Bns."+ii).value = Number(this.getField("Rank Bns."+ii).value) + Number(this.getField("Stat Bns."+ii).value)
+ Number(this.getField("Spec Bns."+ii).value);
this.getField("Total Bns.44").value = Number(racialStatMods[this.getField("Race").value][10])
+ Number(this.getField("Rank Bns.44").value) + (this.getField("Stat Bns.44").value) + Number(this.getField("Spec Bns.44").value);
this.getField("Total Bns.45").value = Number(racialStatMods[this.getField("Race").value][11])
+ Number(this.getField("Rank Bns.45").value) + Number(this.getField("Stat Bns.45").value) + Number(this.getField("Spec Bns.45").value);
this.getField("Total Bns.46").value = Number(racialStatMods[this.getField("Race").value][12])
+ Number(this.getField("Rank Bns.46").value) + Number(this.getField("Stat Bns.46").value) + Number(this.getField("Spec Bns.46").value);
It works as is but I am thinking it might be a little faster if I were to convert the DLJ to work in place of the script in the second section of line 02 above where it calls the DLJ. It would remove the need to call the DLJ. I have been trying to figure this out not for a few hours and I have not gotten anywhere.
I hope someone can help me.
Copy link to clipboard
Copied
Support for all video players options
Find more inspiration, events, and resources on the new Adobe Community
Explore Now