Highlighted

Adding Control Number to Form

Avatar

29-12-2008

I am new to LiveCycle Designer. Is there anyway to add a control number to forms? I would like to have it so that when the form is submitted, the form number will increase by one. Any suggestions?

Replies

Highlighted

Avatar

Avatar

yodadobe

Avatar

yodadobe

yodadobe

29-12-2008

There are many ways to do it. One would be a webservice call in the pre-submit or initialize, depending on when you want it. I add a number on the back end after being submitted.
Highlighted

Avatar

30-12-2008

I am not sure what a webservice call is. By reading online documentation I tried using a variable as a place holder to increase the number by one each time the form is submitted, but that does not seem to work.
Highlighted

Avatar

Avatar

yodadobe

Avatar

yodadobe

yodadobe

31-12-2008

A variable in the form can only keep track of data within that instance. If 5 people open it, all 5 will start at the same number. If the form is opened from disk by a single person, submitted, closed and reopened, it starts at the same number again. You have to have some common point of keeping track of the number. So you have to make a server call, webservice, database, etc. It cannot be done within the scope of a stand alone PDF form.
Highlighted

Avatar

Avatar

pguerett

Total Posts

7.7K

Likes

611

Correct Answer

692

Avatar

pguerett

Total Posts

7.7K

Likes

611

Correct Answer

692
pguerett

05-01-2009

If you do not have access to an external source you could generate a random number based on time but that would not be a sequential number but you can guarantee a unique number.
Highlighted

Avatar

07-01-2009

Thanks for the help on this. I will review some FormCalc documentation to see how best to do this.
Highlighted

Avatar

26-01-2009

Paul, can you post the script how to generate a random number based on time?



Thanks
Highlighted

Avatar

Avatar

pguerett

Total Posts

7.7K

Likes

611

Correct Answer

692

Avatar

pguerett

Total Posts

7.7K

Likes

611

Correct Answer

692
pguerett

26-01-2009

Simply use the FormCalc command Time(). It will return the # of milliseconds since the epoch. I put this command on the initialize evet of the field that I want the number in.



$ = Time()
Highlighted

Avatar

27-01-2009

Paul, do you mean something like this:



$.rawValue = (Math.floor((new Date()) / 1000) ) %1000000000;

My question it is the number will generate will be guarantee a unique number?

What about if two users open the form at the same time?



Thanks again
Highlighted

Avatar

Avatar

pguerett

Total Posts

7.7K

Likes

611

Correct Answer

692

Avatar

pguerett

Total Posts

7.7K

Likes

611

Correct Answer

692
pguerett

27-01-2009

It woudl have to be at exactly the same time (if you include milliseconds in your time then you can be quite certain the the numbers will be unique).