Before I start, I will say that I'm a Java_Virgin. I had a form that had a number that I wanted to increment. Found the following script in another discussion and decided to give it a try.
if (global.count == null) //checks to see if count exists
global.count = 1000000 //sets initial count, you can change to suite your needs
global.setPersistent("count",true) //makes the counter a global object so it is persistent data
global.count++ //increments the the counter by one when the document is opened
var f = this.getField("jobCount") //creates a variable for the form field where the counter will be displayed
f.value = global.count //sets the form field to equal the counter
How do I clear this variable so that the initial number from the script takes effect? I don't mind hand clearing this variable as I only need to do this once every few months.
To delete a global variable you can use the "delete" command, like so (you
can run this code from the JS console):