Skip to main content
markf61508295
Participant
December 22, 2018
Answered

sequential number

  • December 22, 2018
  • 1 reply
  • 1490 views

i know absolutely nothing about java so be patient with me.

i have created a pdf work order that i would like to have generate a new work order number each time i open it.

i dont know where to start from . i have found some script examples but i dont know how to implement or place it to have the result show where i want it on the document.

any help would be greatly appreciated

This topic has been closed for replies.
Correct answer try67

i have entered as you suggested but i am not getting any results.i have included images ,


JavaScript is case-sensitive.

1 reply

try67
Community Expert
Community Expert
December 22, 2018

You can do it using a text field and a script.

What code did you find?

markf61508295
Participant
December 22, 2018

this is the script i found, but having absolutely no knowledge of any kind of computer programming i dont even know where to input or how to do it.

trying to learn and do

thanks for the help and understanding

var f = this.getField("Tracking Number");
if (f.value=="") f.value = "0001";
else f.value = util.printf("%04d", (Number(f.value)+1));

try67
Community Expert
Community Expert
December 23, 2018

That code should work. You just need to create a text field called "Tracking Number" and then paste that code into the editor window under Tools - JavaScript - Document JavaScripts, under a new item (call it "scripts" for example). Make sure to overwrite all pre-existing code in that window, though.