Skip to main content
Known Participant
June 17, 2020
Answered

Random Number Generator

  • June 17, 2020
  • 1 reply
  • 3063 views

I am using a Java Script below to randomly generate a number used for a quote number:

 

this.getField("Quote #").value = (Math.floor(Math.random()*Math.pow(10,13)));

 

It does as it should, everytime you save or close the pdf it generates a new rnadom number.  Is there a way once a copy has been saved that it saves that random number that was generated?  I am trying to use this for generating a quote number to keep on file but once it is saved and reopened it generates a new number.

 

Thanks for your help!

This topic has been closed for replies.
Correct answer Bernd Alheit

Use this:

if (this.getField("Quote #").value == "")

this.getField("Quote #").value = (Math.floor(Math.random()*Math.pow(10,13)));

1 reply

Bernd Alheit
Community Expert
Bernd AlheitCommunity ExpertCorrect answer
Community Expert
June 17, 2020

Use this:

if (this.getField("Quote #").value == "")

this.getField("Quote #").value = (Math.floor(Math.random()*Math.pow(10,13)));

Known Participant
June 17, 2020

Thats exactly what I was looking for!  Thanks!!