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

Avatar

Avatar
Validate 1
Level 5
yodadobe
Level 5

Likes

12 likes

Total Posts

298 posts

Correct reply

10 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 10
Boost 1
View profile

Avatar
Validate 1
Level 5
yodadobe
Level 5

Likes

12 likes

Total Posts

298 posts

Correct reply

10 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 10
Boost 1
View profile
yodadobe
Level 5

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.

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.

Avatar

Avatar
Validate 1
Level 5
yodadobe
Level 5

Likes

12 likes

Total Posts

298 posts

Correct reply

10 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 10
Boost 1
View profile

Avatar
Validate 1
Level 5
yodadobe
Level 5

Likes

12 likes

Total Posts

298 posts

Correct reply

10 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 10
Boost 1
View profile
yodadobe
Level 5

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.

Avatar

Avatar
Boost 500
Level 10
pguerett
Level 10

Likes

612 likes

Total Posts

7,689 posts

Correct reply

692 solutions
Top badges earned
Boost 500
Boost 50
Boost 5
Boost 3
Boost 250
View profile

Avatar
Boost 500
Level 10
pguerett
Level 10

Likes

612 likes

Total Posts

7,689 posts

Correct reply

692 solutions
Top badges earned
Boost 500
Boost 50
Boost 5
Boost 3
Boost 250
View profile
pguerett
Level 10

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.

Avatar

07-01-2009

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

Avatar

26-01-2009

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



Thanks

Avatar

Avatar
Boost 500
Level 10
pguerett
Level 10

Likes

612 likes

Total Posts

7,689 posts

Correct reply

692 solutions
Top badges earned
Boost 500
Boost 50
Boost 5
Boost 3
Boost 250
View profile

Avatar
Boost 500
Level 10
pguerett
Level 10

Likes

612 likes

Total Posts

7,689 posts

Correct reply

692 solutions
Top badges earned
Boost 500
Boost 50
Boost 5
Boost 3
Boost 250
View profile
pguerett
Level 10

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

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

Avatar

Avatar
Boost 500
Level 10
pguerett
Level 10

Likes

612 likes

Total Posts

7,689 posts

Correct reply

692 solutions
Top badges earned
Boost 500
Boost 50
Boost 5
Boost 3
Boost 250
View profile

Avatar
Boost 500
Level 10
pguerett
Level 10

Likes

612 likes

Total Posts

7,689 posts

Correct reply

692 solutions
Top badges earned
Boost 500
Boost 50
Boost 5
Boost 3
Boost 250
View profile
pguerett
Level 10

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