How do I turn the following script into a Document Level Javascript?
Here is the current script that I have in a button:
for (var i=0;i<115;i++)
{
this.getField("Ranks"+i).value=
this.getField("Ranks"+i).value+
this.getField("RanksA"+i).value;
this.getField("RanksA"+i).value=0;
}
I would like to change this into a DLJ that is only called when I hit a button. But I have not been able to figure it out.
I am thinking that the following may work:
function returnAddRnksArray(num)
{
for (var i=0;i<115;i++)
{this.getField("Ranks"+i).value=
this.getField("Ranks"+i).value+
this.getField("RanksA"+i).value;
this.getField("RanksA"+i).value=0;
return [-18, 0.25];}
}
But I am not sure how to use a button to call that function.
The reason I am trying to do this is because the first script I have is really slow when calculating the entire document. As it was explained by others here DLJ's can be faster. This is simply an idea I have to speed up the sheet some. I am not really sure how to have it only call the function when I hit the button and not when I first open the PDF.