Skip to main content
markf61508295
Participant
Dec 22, 2018 5:27 PM UTC
Answered

sequential number

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 is closed to new replies. Start a new post to keep the conversation going.
try67
try67Correct answer
Community Expert
Dec 24, 2018 9:01 AM UTC

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


JavaScript is case-sensitive.

11 replies

try67
Community Expert
Community Expert
Dec 22, 2018 7:50 PM UTC

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

What code did you find?

Translate
markf61508295
Participant
Dec 22, 2018 11:07 PM UTC

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));

Translate
try67
Community Expert
Community Expert
Dec 23, 2018 9:50 AM UTC

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.

Translate